rougier / nano-emacs

GNU Emacs / N Λ N O - Emacs made simple
GNU General Public License v3.0
2.52k stars 195 forks source link

fix misplacement of line number when window body width < total width #11

Closed guiyuanju closed 3 years ago

guiyuanju commented 3 years ago

When using some mode like Olivetti-mode which changes the window-body-width to center the text, the original calculation method will place the line / column number near the middle of mode-line, I don't know if it is on purpose, but I saw the commented code that use window-total-width which forgot the window-right-divider-width, so I made this pull request.

Note the right-up corner, the line column number place: Before:

image

After:

image
rougier commented 3 years ago

Problem is when we have two windows side to side and large divider (such as the default), it also make computation a bit wrong. Maybe it would be best to have a function that return the window width according to current mode or some other conditions. Is there a simple test for testing if in Olivetti mode?

guiyuanju commented 3 years ago

Sorry I'm not sure if it is what you mean by "have two windows side to side and large divider", but I've tested with two windows open and the window-divider-default-right-width set to a bigger number like 256 pixels, and reenable the window-divider-mode to activate the new divider, it seems no problem both in normal mode and Olivetti mode .

image
rougier commented 3 years ago

Ok, I've to test it as bit more then.

rougier commented 3 years ago

Did you test with your proposed patch ?

guiyuanju commented 3 years ago

yes with my patch

rougier commented 3 years ago

Ok, great. Can you rebase your pull request (I did a lot of changes) ?