How to test whether lines of text are greater than the window height

柔情痞子 提交于 2019-12-24 14:28:25

问题


I'd like to test, please, whether the lines of text in a no-file visiting buffer are greater than the window height -- if not, then

(set-window-scroll-bars (get-buffer-window "*Org Agenda*" (selected-frame)) 0 nil)

回答1:


You can test with this:

(> (count-lines (point-min)
                (point-max))
   (window-height))



回答2:


Comparing count-lines with window-height works in some cases but doesn't account for line-wrapping, images, and variable-sized fonts. Another approch is to check if window-end is before point-max.



来源:https://stackoverflow.com/questions/20923655/how-to-test-whether-lines-of-text-are-greater-than-the-window-height

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!