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

Editor: unexpected space=no break space #1030

Open
jlaurens opened this issue Nov 15, 2023 · 3 comments
Open

Editor: unexpected space=no break space #1030

jlaurens opened this issue Nov 15, 2023 · 3 comments
Labels

Comments

@jlaurens
Copy link
Collaborator

Bug description:
The editor sees space and non break space identically.

Steps to reproduce the problem:

  1. Create a .tex file containing the space characters U+0020 and U+00A0.
  2. Open the file with TeXworks

Expected behavior:

TeXworks makes a difference between the spaces like TeX

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

Additional information:

@jlaurens jlaurens added the bug label Nov 15, 2023
@stloeffler
Copy link
Member

What do you mean by "sees them identically"? In my tests (Tw 0.7 on Ubuntu), U+00A0 is preserved during saving and loading and also is "non-breaking" in terms of line wrapping. Visually, it resembles a space (i.e., blank), but if you want you can define a custom syntax highlighting pattern to give it, e.g., a background color.
What kind of other difference would you suggest?

@jlaurens
Copy link
Collaborator Author

On 0.6.8, MacOS 13

  1. create from [email protected] a file with only a U+0020 space and a U+00A0 space.
  2. Open the [email protected] find panel, enter a U+0020 space in the search field
  3. press the Find button: [email protected] only finds the first space: this is an expected behavior
    If you close the file and open it with [email protected], after step 2) [email protected] unexpectedly finds both spaces
    As you mention, the underlying data does make the difference between the spaces.

On 0.7, MacOS 13 (Version 0.7 ("personal") [r.eb0b55e3, 17/03/2024 11:11])

  1. create from [email protected] a file with only a U+0020 space and a U+00A0 space.
  2. Open the [email protected] find panel, enter a U+0020 space in the search field
  3. press the Find button: [email protected] unexpectedly finds both spaces
    With 0.7 the problem occurs even without reopening the file

@stloeffler
Copy link
Member

I see - I can confirm this behavior. Some digging revealed that this might be by design deep in the Qt source code, where QChar::Nbsp is deliberately replaced by a space before searching...
So I guess that means we'll have to write our own search function...

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

No branches or pull requests

2 participants