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

Tab icon glitch when pasting #14410

Closed
alankilborn opened this issue Nov 25, 2023 · 9 comments
Closed

Tab icon glitch when pasting #14410

alankilborn opened this issue Nov 25, 2023 · 9 comments
Assignees
Labels

Comments

@alankilborn
Copy link
Contributor

Description of the Issue

When experimenting with Notepad++ 8.6's new multi-select feature, in certain circumstances when pasting, I noticed a visual glitch of the tab's icon. Looking closer it briefly changes to a "lock" icon before quickly changing back to a "pencil" icon.

Steps to Reproduce the Issue

  1. Checkmark Alternate icons in the Editing preferences.
  2. Create some text in a new tab:
bbbbbbbbbb
bbbbbbbbbb
bbbbbbbbbb
bbbbbbbbbb
bbbbbbbbbb
bbbbbbbbbb
ccccccccc
ddddddddd
eeeeeeeee
  1. Make a column block selection:
    image
  2. Press Ctrl+c to copy that selection.
  3. Create some "multi-carets":
    image
  4. Press Ctrl+v to paste, while (IMPORTANT!) watching the file tab icon closely.

Expected Behavior

No visual glitch of tab icon at paste.

Actual Behavior

Visual glitch of tab icon at paste.
I see the "lock" briefly before it switches back to the "pencil".

Debug Information

Notepad++ v8.6 (64-bit)
Build time : Nov 23 2023 - 16:58:44
Path : C:\NotepadPlusPlus\Misc_NoBackup\Releases\npp.8.6\npp.8.6.portable.x64\notepad++.exe
Command Line : -multiInst
Admin mode : OFF
Local Conf mode : ON
Cloud Config : OFF
OS Name : Windows 11 Pro (64-bit)
OS Version : 22H2
OS Build : 22621.2428
Current ANSI codepage : 1252
Plugins :
mimeTools (2.9)
NppConverter (4.5)
NppExport (0.4)

@alankilborn
Copy link
Contributor Author

I think I tracked the glitch to this line in the code:

// Hack for preventing the char "SYN" (0x16) from being adding into edit zone 
buf->setUserReadOnly(true);

https://github.com/notepad-plus-plus/notepad-plus-plus/blob/2768cf5422e6a443e7ed043ddd21a961e5c9859d/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp#L687C8-L687C8

If I comment-out this line and run, then do the STR (Steps To Reproduce) above, I don't see the glitching I described.

And...I don't see a "SYN" character added into the edit zone; using this setup:

image

@alankilborn
Copy link
Contributor Author

@donho Are you sure you were getting a "SYN" character put into the edit zone, before adding the hack? If you remove the hack, can you give some STR (steps to reproduce) so that I could see it as well?

@pryrt
Copy link
Contributor

pryrt commented Nov 25, 2023

I forgot step1, but I was able to replicate with my screen-capture software running. The read-only mode lasts about 130ms.

@donho
Copy link
Member

donho commented Nov 26, 2023

@alankilborn @pryrt
This is intentional hack, due to between Ctrl-V keyDown & keyUp there is SYN char added.
The solution (hack) is make document read-only to prevent SYN from being added, then while keyUp, remove read-only from document.

I have no better solution so far. Please create a PR if you've got one.

If you remove the hack, can you give some STR (steps to reproduce) so that I could see it as well?

Just turn on "Show All Characters".

@donho donho added the known issue The issue was known, but won't be fixed or cannot be fixed label Nov 26, 2023
@alankilborn
Copy link
Contributor Author

Just turn on "Show All Characters".

But...from my screenshot earlier I have Show Control Characters... on already, and SYN is a control character. I wonder why I do not see it?

@donho
Copy link
Member

donho commented Nov 26, 2023

@alankilborn
If you comment set read-only as following:

// Hack for preventing the char "SYN" (0x16) from being adding into edit zone 
//buf->setUserReadOnly(true);

Then do as following: #14338 (comment)

What do you see?

@alankilborn
Copy link
Contributor Author

What do you see?

After the paste, I see the following (incorrect) result, but no SYN character:

image


To show that I have visible control characters turned on, I move to lower in the file and type some Ctrl+e (an unmapped shortcut) characters:

image

@donho
Copy link
Member

donho commented Nov 26, 2023

@alankilborn

Now you modify the code to the following:

if (pasteToMultiSelection())
{
	// Hack for preventing the char "SYN" (0x16) from being adding into edit zone 
	//buf->setUserReadOnly(true);

	//_isMultiPasteActive = true; // It will be set false with WM_KEYUP message
	return TRUE;
}

and do the same manipulation, you will see SYN char appear.

@alankilborn
Copy link
Contributor Author

Ok, got it, thank you:

image

I'll see if I have some ideas about it...

donho added a commit to donho/notepad-plus-plus that referenced this issue Nov 28, 2023
Remove also Shift-DEL, Ctrl-INS & Shift-INS shortcut from Scintilla.
Ref: notepad-plus-plus#14401 (comment)

Fix notepad-plus-plus#14410
@donho donho added accepted and removed known issue The issue was known, but won't be fixed or cannot be fixed labels Nov 29, 2023
@donho donho self-assigned this Nov 29, 2023
@donho donho closed this as completed in 0978b2e Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment