Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maple-imenu-autoresize 显示不完整 #2

Closed
e190 opened this issue Dec 27, 2022 · 1 comment
Closed

maple-imenu-autoresize 显示不完整 #2

e190 opened this issue Dec 27, 2022 · 1 comment

Comments

@e190
Copy link

e190 commented Dec 27, 2022

开启 maple-imenu-autoresize 后,最长的那个条目 仍然 显示不完整。
图片

我觉得应该是 Variables Functions 标题前面有个三角符号,导致窗口计算不对。

(defun maple-imenu-refresh()
  "Refresh imenu buffer."
  (interactive)
  (maple-imenu--with-writable
    (erase-buffer)
    (dolist (item (maple-imenu--entries))
      (maple-imenu--handler item)))
  (when maple-imenu-autoresize
    (maple-imenu--with-window
      (let ((fit-window-to-buffer-horizontally t))
        (fit-window-to-buffer)))))

我想在 maple-imenu-autoresize 的基础上 多增加两个字符的宽度,就没问题了。
不知道 怎么来做这个功能

@honmaple
Copy link
Owner

honmaple commented Feb 2, 2023

现在适应窗口大小是用的内置函数fit-window-to-buffer, 如果想要真正完全适应,必须逐行统计并计算buffer内的最大长度,还有一种方式是可以使用两次fit-window-to-buffer

(when maple-imenu-autoresize
    (maple-imenu--with-window
      (let ((fit-window-to-buffer-horizontally t))
        (fit-window-to-buffer)
        (fit-window-to-buffer nil nil nil nil (+ (window-width) 5))
        )))

或者打开自动换行toggle-truncate-lines, 不过我觉得太长的函数名是没必要显示完整的,会影响正文显示

@e190 e190 closed this as completed Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants