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

Word wrap is slow #692

Open
25minutes opened this issue Jul 27, 2023 · 7 comments
Open

Word wrap is slow #692

25minutes opened this issue Jul 27, 2023 · 7 comments

Comments

@25minutes
Copy link

In latest stable version Notepad2_en_AVX2_v4.23.06r4862, word wrap is slow. For example, it takes over 5 seconds on a small 1.2MB text file (sample file attached).
1.zip

Reproduce steps:

  1. Turn off word wrap.
  2. Load the sample text file, which should complete instantly.
  3. Turn on word wrap. Notepad2 becomes unresponsive for a few seconds.

This doesn't happen on original notepad2-mod and Notepad3. On the same PC, both of them complete word wrap almost instantly.

As all these 3 editors are Scintilla based, it's a bit strange to see such a big difference.

BTW, I've already configured notepad2 to use GDI and monospaced font.

@zufuliu
Copy link
Owner

zufuliu commented Jul 27, 2023

The slow is not replaceable on my system. you can configure Notepad2 to use Direct2D or different wrap mode (default "Automatic word wrap" is the slowest one) to speedup word wrap.

@zufuliu
Copy link
Owner

zufuliu commented Jul 27, 2023

The slow is not replaceable on my system.

Reproduced when using "2nd Text File", works fine with "Text File" scheme.

@25minutes
Copy link
Author

Thanks for the quick response.

I've changed wrap mode to "wrap text between words" but the issue persists. Direct2D doesn't help either, and if possible, I'd prefer to keep using GDI because one of my PC is still Windows 7 and Direct2D doesn't work well.

I'm always using the default "Text File" scheme. I though "2nd Text File" is simply a set with different font/color settings. Would it affect word wrap function?

I attach my Notepad2.ini for your reference. You might need change font because Monaco monospaced font isn't system default.
Notepad2.zip

@zufuliu
Copy link
Owner

zufuliu commented Jul 27, 2023

@zufuliu zufuliu added this to the v4.23.08 milestone Jul 27, 2023
@25minutes
Copy link
Author

Awesome! You identity the root cause so quickly :)

@zufuliu
Copy link
Owner

zufuliu commented Jul 27, 2023

Fixed by 763569c. however we should really implement parallel WrapBlock() (Scintilla 5.3.4) to speedup wrap all lines.
https://github.com/zufuliu/notepad2/blob/95a5f62a62933e4759daa1cb9eb4f9ce6ef3d8bf/scintilla/src/Editor.cxx#L1494-L1496

@zufuliu
Copy link
Owner

zufuliu commented Jul 27, 2023

Marked as breaking change: after toggle word wrap, caret maybe invisible with the change.

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