-
Notifications
You must be signed in to change notification settings - Fork 236
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
WrapText + LineNumber, wrong line numbers position #488
Comments
Since you can implement your own |
Isn't it a bug? All editors I know (JetBrains IDEs, Github, ...) use top alignment for line numbers. |
Right, but AFAIK, all code editors don't wrap their lines like you are doing. |
They all have option to wrap, and it can be useful for non-code text files, some config files. Not sure why would anyone prefer middle alignment for line numbers :) |
Mm.. makes sense. If we just make LNF layout its children at the top, won't that properly lay out the number regardless of wrapping? |
Couldn't you use |
Or is that what you meant by "I thought that it would be possible to use right alignment?" |
Yeah, Currently there is no difference between RIGHT and CENTER because it is padded with 0s (and without 0s width is not the same for all lines). |
One other possibly-related problem is if one scrolls a very long document. When only lines 0-9 (single digit) are displayed, the LNF will probably only display just enough horizontal space for those items. As soon as lines 10-99 (double digits) are displayed, the LNF will increase the horizontal space to account for the extra digit. This will cause an unexpected jump in the rendering of the text as it is suddenly rendered farther to the right. Moreover, this jump will occur as soon as lines 100, 1.000, and 10.000 are rendered. |
You mean the jump that I showed on the screenshot above (#488 (comment))? I don't see any other jumps (spellchecking demo with 12000 lines). |
Yup! Just pointing out that that is also part of the issue the solution
would need to address.
|
When removed padding with zeros? Then maybe a simple solution would be to pad with spaces, since the line number font is monospace. |
Good idea. However, shouldn't the LNF still work correctly even when one does not want monospace to be used? Then again, would that go far enough outside the scope of this project that a person who wants that should just implement their own LNF? |
As far as I can see user cannot change font now, it's just a static private field. |
It's possible by styling its CSS class |
Ah, yes. But if someone really wants a non-monospace font for line numbers, then they can just set Padding with spaces can be implemented using format like this: |
And in case they don't, they should just create their own LNF?
So, we should change the Pos to be at the top, add another parameter to the base LNF constructor that allows one to pass in the type of formatting to use (spaces or zeros), and update the regular |
There is already such constructor. Or you mean to add another constructor with just one character (string) instead of formatting function? |
Fix line numbers alignment and change default padding to spaces. #488
Closed by #489. |
Sorry, I forgot there was already a constructor for that. It's been a while since I looked at that file. Everything I said before was from memory. |
When text wrapping and line numbers are enabled, line numbers are displayed incorrectly (which is very confusing and makes them unusable):
They displayed in the center instead of the beginning of the line, like in other text editors. For example Notepad++:
Tried in current master spellchecking demo, as well as in my project with stable and milestone RichTextFX releases.
The text was updated successfully, but these errors were encountered: