Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide line number on wrapped lines #4991

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lobre
Copy link
Contributor

@lobre lobre commented Sep 28, 2023

I started discussing this topic on that issue: #4982 (comment)

This is a draft, so it does not implement the whole behavior, and it is really rough. This is more to discuss the idea, and the implementation can be reviewed then.

This is about trying to hide line numbers on lines that are wrapped. As of today, line numbers are duplicated when lines are wrapped. This duplication can be desired for some users. But for some others, they prefer having them hidden, to clearly distinguish a regular line from a wrapped one.

So the idea of this PR is to draw empty spaces in replacement of the line number for wrapped lines. And this could be activated using an option on the number-lines highlighter.

What do you think?

See the result:

wrap_lines_double

wrap_lines_hidden

@ftonneau
Copy link

ftonneau commented Feb 25, 2024

I wonder whether this proposal if necessary, because hiding line numbers can be easily done within any color scheme with set-face global LineNumbersWrapped .... To hide wrapped line numbers, just set their foreground color equal to the background color for LineNumbers. Here is a screenshot as example:

shot

@lobre
Copy link
Contributor Author

lobre commented Feb 25, 2024

If you check the comment I mentioned in my message, you can see that this workaround does not work if you are using the default color for LineNumbers unfortunately.

@ftonneau
Copy link

ftonneau commented Feb 25, 2024

You are correct -- however, another workaround in the case of LineNumbers with the default background is to color the wrapped line numbers white (in the case of a light theme) or black (in the case of a dark theme). The wrapped line numbers will be virtually invisible even though their color is technically different from that of the background. (I know because I tried.) In any case, the issue can always be dealt with by tuning the color scheme you are using.

@lobre
Copy link
Contributor Author

lobre commented Feb 26, 2024

The wrapped line numbers will be virtually invisible even though their color is technically different from that of the background.

It depends on how perfectionist you are ^^. I like simple designs, and simple themes, and relying on such a solution makes the experience dirty to my eyes. Of course, it kinda works, but if you carefully look, you see the difference in colors.

I understand that workarounds exist, but to me they still are hacks. And this PR is about doing something clean about the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants