1

I'm writing a really long file that it has more than 1000 lines. Somehow, starting at line 1000, all text is moved one char to the right (see how the ruler at line 1000 is misaligned in the picture below). The things that I tried:

  • I checked all the content and it looks normal, also from a terminal so I can reviewed without formatting.
  • I reverted the buffer. No fix.
  • Restarted Emacs and PC. No fix.

enter image description here

1 Answer 1

1

I had line numbers enabled (display-line-numbers-mode). Up to line 999, the line numbers were only three digits wide, but when I reached line 1000, the extra digit made the margin for line numbers wider. This shifted all the visible text, including org-mode headers, one character to the right.

The actual file content was never affected; it was purely a visual alignment change.

Because I don't want to see that visual "jump", I used (setq display-line-numbers-width 4) so it tells Emacs to reserve a fixed width of 4 characters for the line number column.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.