zufuliu / notepad4

Notepad4 (Notepad2⨯2, Notepad2++) is a light-weight Scintilla based text editor for Windows with syntax highlighting, code folding, auto-completion and API list for many programming languages and documents, bundled with file browser plugin matepath.
Other
2.56k stars 179 forks source link

Display problem #708

Closed Matteo-Nigro closed 12 months ago

Matteo-Nigro commented 1 year ago

Hi @zufuliu! I wanted to report a problem I am experiencing.... Nothing serious, but it's annoying. It often happens (but not always) that when I open .txt files (at the moment it seems to me the only format with the problem) only the first line of the file content is shown. After the first click anywhere in the program, the entire contents are shown. At the moment I use Direct 2D as rendering technology, I haven't tried anything else for the moment... Any ideas on how to solve this? As always, thank you 😉!

image

After the first click:

image

zufuliu commented 1 year ago

can't reproduce the bug after some tries.

zufuliu commented 1 year ago

Lines are painted inside EditView::PaintText(): https://github.com/zufuliu/notepad2/blob/f10f6ab25818fdcf31a9c477b12d34b119ffa125/scintilla/src/EditView.cxx#L2772-L2774

You can change #if 0 to #if 1 then adding logs inside EditView::PaintText(), Editor::Paint(), etc. to see what happened? https://github.com/zufuliu/notepad2/blob/f10f6ab25818fdcf31a9c477b12d34b119ffa125/src/Notepad2.c#L510-L514

Matteo-Nigro commented 1 year ago

Hi @zufuliu, I have SOLVED 🎉 🎉 🎉 🎉 🎉 ! I did as you told me but got no meaningful response from the logs. I didn't realise that I had unintentionally set the zoom in the editor to 110%.... By resetting the zoom to 100% the problem disappeared. I don't know if this is just my problem or if it could be a potential bug.

zufuliu commented 12 months ago

Not reproduce with 110% (or others) zoom level.

Matteo-Nigro commented 12 months ago

Update: I confirm that if I open the text file by double-clicking the problem no longer occurs, but if I open the files by dragging them into the application, the problem persists. The editor only updates after the first click. With files with coloured syntax, no problem. I attach gifs:

Animazione

zufuliu commented 12 months ago

That's really wild, the code for drag & drop is inside MsgDropFiles(): https://github.com/zufuliu/notepad2/blob/f10f6ab25818fdcf31a9c477b12d34b119ffa125/src/Notepad2.c#L1036-L1038

Animation

Matteo-Nigro commented 12 months ago

Further update: I figured out which parameter is "triggering" the problem... deleting my configuration .ini file everything worked... Deleting one item at a time I realized that the problem lies in the ShowBookmarkMargin activation . Keeping it deactivated even with different zoom levels the bug no longer occurs for me. In your test I see that it is deactivated... Can you check if the problem also occurs to you by enabling this option? I think it's something inside this function or related to it: https://github.com/zufuliu/notepad2/blob/f10f6ab25818fdcf31a9c477b12d34b119ffa125/src/Styles.c#L2969-L3013 I think it could be a good lead to follow 😎

zufuliu commented 12 months ago

OK, reproduced with ShowBookmarkMargin enabled.

zufuliu commented 12 months ago

Fixed by 3e84cce7460783cde3a9562bbe42542a39db36af.

zufuliu commented 12 months ago

Hi @Matteo-Nigro, please help test latest code, I'm planing to make a new release on Monday, thanks.

Matteo-Nigro commented 12 months ago

Hi @zufuliu , I confirm that after https://github.com/zufuliu/notepad2/commit/3e84cce7460783cde3a9562bbe42542a39db36af the problem no longer occurs. 🎉 Thanks for the hotfix!