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

html等文件类型,当文件较大光标移动时失去响应 #911

Open
softmgr opened this issue Nov 11, 2024 · 5 comments
Open

html等文件类型,当文件较大光标移动时失去响应 #911

softmgr opened this issue Nov 11, 2024 · 5 comments
Labels
large file upstream scintilla Changes depends on upstream Scintilla 🛠workaround Workaround available
Milestone

Comments

@softmgr
Copy link

softmgr commented Nov 11, 2024

已经测试较大的html文件,如200MB+,当打开语法高亮显示时,如果光标移到不是匹配的括号位置,整个界面会卡顿好几秒不响应。。关闭自动完成设置中的自动完成括号没有用,依然卡顿失去响应。
例如:

<!-- 在这前面会有非常多内容,例如有200MB+的内容...... -->
2) Credit and Thank-You
<!-- 其它HTML代码 -->

以上示例中,当光标插入点位于 Credit的"C"(列4),再按方向键左,这时整个编辑器会卡住好几秒不响应;继续在第3列按方向键左,这时整个编辑器还会卡住好几秒不响应;在第2列按方向键右,还会卡住好几秒不响应。如果文件更大,则会直接因不响应而崩溃。

@zufuliu
Copy link
Owner

zufuliu commented Nov 12, 2024

Filled https://sourceforge.net/p/scintilla/feature-requests/1533/, commit 7e449bc optimized brace match, please test latest builds from https://github.com/zufuliu/notepad4/actions.

For large file, turn off word wrap would improve experience.

@zufuliu zufuliu added 🛠workaround Workaround available and removed word wrap labels Nov 13, 2024
@zufuliu
Copy link
Owner

zufuliu commented Nov 13, 2024

再按方向键左,这时整个编辑器会卡住好几秒不响应

Workaround: uncheck "View -> Visual Brace Match Ctrl + Shift + V".

@softmgr
Copy link
Author

softmgr commented Nov 13, 2024

再按方向键左,这时整个编辑器会卡住好几秒不响应

Workaround: uncheck "View -> Visual Brace Match Ctrl + Shift + V".

我个人认为可以改成文本文件全局关闭括号匹配。以及文件大小较大(超过阈值),也自动关闭括号匹配。

@zufuliu
Copy link
Owner

zufuliu commented Nov 14, 2024

我个人认为可以改成文本文件全局关闭括号匹配。以及文件大小较大(超过阈值),也自动关闭括号匹配。

A better approach would limit the time to find match brace (e.g. 250ms), after timeout do not show whether current brace is matched or not. Mark occurrences use this approach but continue finding occurrences when editor is idle again, so Fnd number on statusbar is continuously updating.

notepad4/src/Notepad4.cpp

Lines 651 to 662 in 7e449bc

while (true) {
if (editMarkAll.pending) {
WaitableTimer_Set(timer, WaitableTimer_IdleTaskDelayTime);
while (editMarkAll.pending && WaitableTimer_Continue(timer)) {
if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) {
DispatchMessageMain(&msg);
}
}
if (editMarkAll.pending) {
editMarkAll.Continue(timer);
}
}

@zufuliu
Copy link
Owner

zufuliu commented Nov 26, 2024

A better approach would limit the time to find match brace (e.g. 250ms)

Brace matching is now optimized with SSE2/AVX2, as it's very faster, I'm not going to implement timeout behavior or disable it for large file. Please test latest build from https://github.com/zufuliu/notepad4/actions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
large file upstream scintilla Changes depends on upstream Scintilla 🛠workaround Workaround available
Projects
None yet
Development

No branches or pull requests

2 participants