coteditor / CotEditor

Lightweight Plain-Text Editor for macOS
https://coteditor.com
Other
6.22k stars 424 forks source link

Line numbers in vertical orientation are too squeezed to be readable in longer documents #1608

Closed dannyow closed 3 months ago

dannyow commented 3 months ago

Description

Drawing every 5th number works well till we hit 100th line, after line numbers are too close to each other to be readable.

It's ok here:

image

Here is getting messy:

image

Possible solutions:

  1. use smaller font size for numbers between the 5th markers - sufficient till 1000th line I guess
  2. display only the last two digits of the line number: e.g., 100, ·01, ·02, ·03, ·04, 105

To Reproduce

Open document with vertical orientation...

Expected behavior

No response

CotEditor version

4.7.4, 4.8.0-beta.3

macOS version

13.6.4, 14.4

Additional context

No response

dannyow commented 3 months ago

I made a quick and dirty prototype, with using only last two digits and shifting the baseline - just to see how it looks.

Results:

Not perfect, but usable.

@1024jp WDYT?

1024jp commented 3 months ago

Actually, this part has been on my mind for a long time, but I've been putting it off. Thank you for the feedback. After your post, I reviewed again the code around the line number view and feel I also should refactor there a bit. I'll make it somehow better in the next version.

Your idea to display only the last digits is interesting (maybe the last one digit is enough, though). I'll also consider whether there is a better way. Let me think.

1024jp commented 3 months ago

Still not perfect, but I suppose now it becomes better.

https://github.com/coteditor/CotEditor/assets/1165044/a1d2fea5-33dc-47c5-a059-b0185bd75949

dannyow commented 2 months ago

Looks good enough :) I mean there is still the edge case when you pointing out the line number next to the one already visible (eg. 5654)

image