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

Long Line screen update bug #782

Open
meteorquake opened this issue Mar 28, 2024 · 8 comments
Open

Long Line screen update bug #782

meteorquake opened this issue Mar 28, 2024 · 8 comments

Comments

@meteorquake
Copy link

meteorquake commented Mar 28, 2024

I have a normal JS file, but there's an initiation function at the end containing a 99K string that's used to populate a global variable with keys and values, so that variable appears earlier in the code for usage (after being populated by a call to that end function).

If in word-wrap mode I go to the earlier variable reference and do a Ctrl-F3 to find the next usage, it accordingly jumps to the reference that's immediately after that long string.

The variable and its line accordingly appears and you would want the tail end of that long string to show above it.
What actually happens is that the screen part above it where the string tail end should show does not update and so continues to show the code which was showing there prior to the Ctrl-F3 jump. It can also obviously do it using Ctrl-End to get there.
However the slightest movement such as an arrow right to move the cursor, causes that part of the screen to update and the string tail end to show.
It is slightly layout specific - at a slightly different zoom it may show the tail end correctly, and depending on the starting line when Ctrl-End is pressed it may or may not do it.

I'm not sure how long the long line has to be for this artifact to happen, but it's definitely not acting as it should, and the update that happens when the cursor is moved shows that it's quite capable of showing it correctly.

The long line is of the form (where the dots are characters with few spaces in):

var a='.....................'.split(',');

Notepad2 (64-bit) 4.24.03 r5146 (7c12b83)
Compiled on Mar 17 2024 with Visual C++ 19.39.33522.0,
Scintilla 5.4.1.
Encoding: UTF-8, Windows-1252
Scheme: , JavaScript
System: 10.0.19045 x64

bug also present on r5052.

Cheers, David

@zufuliu
Copy link
Owner

zufuliu commented Mar 29, 2024

This is due to partial line layout for long line limited the time (250ms) to wrap long line to avoid UI freeze.

@meteorquake
Copy link
Author

Thanks, I thought it would be something practical. What is the mechanism behind the line being instantly shown when I then move the cursor a tiny amount - has it by that time worked it out as a background task?

@zufuliu
Copy link
Owner

zufuliu commented Mar 29, 2024

Lines are wrapped when editor is idle (250ms a time), Ctrl + End force whole line be wrapped (UI may freeze), go to specific column force the target position + next 4KB bytes on the line be wrapped.

https://github.com/zufuliu/notepad2/blob/065c63a0c948bcf69278a8f235ffc9583000e2f1/scintilla/src/EditView.cxx#L433-L446

@meteorquake
Copy link
Author

meteorquake commented Mar 29, 2024

I suppose this raises the question of whether it should go on to display it when the layout becomes available, or else show some kind of mask-out for the area concerned.
I realise it's slightly a niche case although I suspect with anyone viewing long lines of obfuscated JS code it may be less niche than imagined. (In my case it was a slab of data summarising prior years to straddle the fact that my workplace has changed accounting systems and a report needs to include old data from the old system to compare the new data with.)

@zufuliu
Copy link
Owner

zufuliu commented Mar 29, 2024

It should display the code folding ellipsis at line end (similar to VSCode) when the line is not whole wrapped.
image

https://github.com/zufuliu/notepad2/blob/065c63a0c948bcf69278a8f235ffc9583000e2f1/scintilla/src/EditView.cxx#L1322-L1330

@meteorquake
Copy link
Author

meteorquake commented Mar 29, 2024

In word-wrap mode it's showing code from much earlier in the document (whatever was at the location I had jumped from, as it simply doesn't update the screen).

@zufuliu
Copy link
Owner

zufuliu commented Mar 31, 2024

Hi @meteorquake, can you test latest builds from issue-782 branch (e.g. https://github.com/zufuliu/notepad2/actions/runs/8494534394)?

@zufuliu
Copy link
Owner

zufuliu commented May 25, 2024

deleted issue-782 branch, call Redraw() has no effect due to redrawPendingText is true, see https://sourceforge.net/p/scintilla/bugs/2436/.

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