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

U+2028 LINE SEPARATOR in editor #1028

Open
jlaurens opened this issue Oct 1, 2023 · 3 comments
Open

U+2028 LINE SEPARATOR in editor #1028

jlaurens opened this issue Oct 1, 2023 · 3 comments

Comments

@jlaurens
Copy link
Collaborator

jlaurens commented Oct 1, 2023

Bug description:

Here is the source
Capture d’écran 2023-10-01 à 12 01 06
Here is the output
Capture d’écran 2023-10-01 à 12 01 16

At the end of the first line, there is a U+2028 line separator.
It causes TeX line numbering and TeXworks line numbering to be different.

Originally, the U+2028 line separator was entered accidentally, but it may exist in the tex source for some good reason.

Steps to reproduce the problem:

Expected behavior:

General information:
TeXworks version: Version 0.6.8 ("github") [r.6b1c6ab, ]
TeXworks obtained from:
Operating system:

Additional information:

@stloeffler
Copy link
Member

Thanks for reporting. Unfortunately, this can't be fixed (easily) on the TeXworks side as the line numbering relies on Qt's internal text layouting for identifying "text blocks" (=lines). The Qt routines treat U+000A, U+000D, and U+2029 as "block/paragraph separators", while U+2028 is not considered to start a new "block/paragraph". Apart from bypassing (and therefore rewriting) the entire text layout code of Qt, there is not much I can do. You can raise the issue with the Qt devs, though, of course

@jlaurens jlaurens reopened this Oct 24, 2023
@jlaurens jlaurens self-assigned this Oct 24, 2023
@jlaurens
Copy link
Collaborator Author

One solution is to change any U+2028 into U+000D.
There is another similar problem with some unicode space characters that do not have the correct TeX category code.
The editor displays a normal space whereas TeX sees an "other" character.

I'll see what I can do in some distant future.

@stloeffler
Copy link
Member

As you wrote in your original post: U+2028 "may exist in the tex source for some good reason". So I don't like arbitrarily changing characters (in fact, Tw goes to some lengths to preserve unicode BOM while avoiding visual artifacts).

I think the "proper" way of fixing this would be to somehow "hack" into the existing text document layout - or even implement a completely custom one (which would also avoid problems such as #469), but that's probably a monumental undertaking...

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

No branches or pull requests

2 participants