emacs-vdiff icon indicating copy to clipboard operation
emacs-vdiff copied to clipboard

Fold string too long when using display-line-numbers-mode

Open brownts opened this issue 2 years ago • 0 comments

When using folding in combination with truncation disabled, such that the text of the file is wrapped, it is noticeable when using display-line-numbers-mode that the fold string can be too long.

This is likely due to the calculation in vdiff--make-fold relying on window-width and not taking into consideration the width of the line numbers themselves. According to this thread, line-number-display-width can be used to retrieve the amount of space used for showing the line number.

Note also that depending on the settings for display-line-numbers-mode, the actual width of the window used by the line number may grow and shrink based upon where you are in the document. Thus, invoking display-line-numbers-mode will be different depending on where in the document you are. It likely cannot be relied upon alone to calculate the number of columns, especially when folding is being used. It may be necessary to explicitly set the display-line-numbers-width when this mode is enabled. There is some text in the manual which indicates this could be problematic.

brownts avatar Sep 25 '21 20:09 brownts