Code::Blocks Forums

User forums => Help => Topic started by: nenin on May 29, 2020, 08:15:15 am

Title: FLUID and mouse selection
Post by: nenin on May 29, 2020, 08:15:15 am
I`m observing strange issue:
I`m using FLUID  (FLTK form designer) from C::B (through file association in project tree). Almost any time after I finishing FLUID editing and switch to C::B mouse starts to select text in current file. Likely it is related to reopening generated source file in C::B.
Observed on 20.3+ and Win10.
Title: Re: FLUID and mouse selection
Post by: BlueHazzard on May 29, 2020, 11:07:22 am
How do you switch? Alt tab?

Can you describe the problem in more detail?
Step by step to be able to reproduce..
Title: Re: FLUID and mouse selection
Post by: nenin on May 29, 2020, 12:28:39 pm
Alt-Tab. I`ll do it at Monday, from work PC.
Title: Re: FLUID and mouse selection
Post by: nenin on June 01, 2020, 07:58:20 am
Situation found to be reproducible if source file, which is  already open in C::B, changed outside, after this dialog (see attach) jumped out. It looks like this artefact does not appear after Alt-Tab or TaskBar switching, but it appears after task switching by mouse click on C::B editor area.
FLUID is not a source, the same effect can be reproduced by external text editor. Looks like mouse event is somehow corrupted when C::B catches focus in this way.
Title: Re: FLUID and mouse selection
Post by: BlueHazzard on June 01, 2020, 09:07:25 am
Can you try to reproduce this in notepad++?

i somehow can not reproduce it, or i do something wrong...

[Edit:] if i use alt+tab cb always ask if i want to reload the code, and then this selection issue does not happen for me...
Can you make a step by step description, like
1) Open codeblocks
2) Open file in editor
3) Open the same file in external editor, by going->Start->Notepad.exe->Enter
4) Modify the file in notepad
5) Save the file in notepad
6) Switch to codeblocks by pressing alt+tab
7) No dialog appears
8) text is selected
Title: Re: FLUID and mouse selection
Post by: BlueHazzard on June 01, 2020, 09:14:13 am
Ok, i can reproduce now. You have to switch editor by clicking the mouse in codeblocks:
1) Open Codeblocks
2) Open text file in codeblocks
3) Open the same text file in an external editor
4) Both editors have to be seen on the screen
5) Modify the text in the external editor and save
6) Click in codeblocks.
7) The reaload dialog appears, say reload yes
8) Random text is selected
Title: Re: FLUID and mouse selection
Post by: BlueHazzard on June 01, 2020, 10:36:48 am
I created a ticket for this:
https://sourceforge.net/p/codeblocks/tickets/974/
Title: Re: FLUID and mouse selection
Post by: nenin on June 01, 2020, 01:21:07 pm
Thanks!
Title: Re: FLUID and mouse selection
Post by: Pecan on June 01, 2020, 06:53:45 pm
I cannot recreate this situation using codeblocks and notepad.
What external editor are you using?

Windows 10, Codeblocks rev 12040.
Are you running/enabling the MouseSap plugin?
Title: Re: FLUID and mouse selection
Post by: nenin on June 02, 2020, 07:47:50 am
I tried with enables and disabled MouseSap - glitch is the same.
I observed it with FLUID (FLTK form designer) and CudaText.  Now checked with Notepad- the same story. 
I doubt it is somehow related to external editor, looks like mouse event somehow corrupted during switching context form the external editor to C::B.
Issue with autoselection appeared if I:
1. Save already opened in C::B source file in external editor
2. Switch from visible on top ext.editor to underlaying C::B  by clicking the mouse on C::B editor context. Looks like it not appears if click was made on the other C::B zones- menu, toolbar... After clicking on  C::B window top bar I got this message (see attach.). No RPT was generated, C::B continue to work without selection issues.

CodeBlocks 12091 (but it was observed from 20.03), Win 10.
Title: Re: FLUID and mouse selection
Post by: Pecan on June 02, 2020, 08:04:15 pm
Are you running a clip board (cut/paste) handler in the background?

Would you disable the plugins one at a time to see if disabling one solves the problem.

Would you list for us, the plugins you are running so we can try to create an environment like yours to test with.
Title: Re: FLUID and mouse selection
Post by: BlueHazzard on June 02, 2020, 08:46:31 pm
For me normal environment, all plugins enabled (not so recent) trunk build, windows 10
Title: Re: FLUID and mouse selection
Post by: nenin on June 03, 2020, 07:40:22 am
Are you running a clip board (cut/paste) handler in the background?

Would you disable the plugins one at a time to see if disabling one solves the problem.

Would you list for us, the plugins you are running so we can try to create an environment like yours to test with.
I dont have any clipboard handler installed. I have Keepass installed, but it was not running when I observe issues.
I only switched off MouseSap after your post. So all other is active. I didnot install any additional. See.attach.
 
Title: Re: FLUID and mouse selection
Post by: Pecan on June 05, 2020, 09:20:09 am
I cannot recreate this problem with current head (12166) with all plugins enabled. Windows 10. Sorry that I won't be able to help.
Title: Re: FLUID and mouse selection
Post by: AndrewCot on September 18, 2021, 06:37:45 am
One of my friends is having this issue with the SVN 12516 on Ubuntu 20.04.

I have been able to reproduce it (same process as bluehazzard post #5) on the following systems with the SVN 12529 trunk code locally built Code::Blocks:
1) Windows 10 with Notepad++ as the other editor
2) Xubuntu 20.04 with Mousepad as the other editor

I have no third party clipboard handlers installed on either OS.

Any ideas on where in the code I should start to look for the bug to help out? Even a keyword to search for at would be helpful or a directory to look at etc.
Title: Re: FLUID and mouse selection
Post by: AndrewCot on September 18, 2021, 07:39:54 am
I have spotted that when doing the following process on Windows:

1) Open Codeblocks
2) Open text file in codeblocks
3) Open the same text file in an external editor (on Windows notepad++ for example)
4) Both editors have to be seen on the screen
5) Modify the text in the external editor and save
6) Left mouse click in codeblocks.
7) The reload dialog appears, say reload yes
8) The wxScintilla code selects text based on the mouse movements.

The wxScintilla::OnMouseLeftUP(...) in wxScintilla.cpp is NOT called after you release the left mouse button in step 6 and as such the code thinks that you still have the left button pressed and therefore are wanting to select the text in step 8, EXCEPT as the file has been modified the file is reloaded and the text selection should not occur.

Sorry, but I am not familiar enough with the code at this point in time to figure out why or what to do next.

Title: Re: FLUID and mouse selection
Post by: AndrewCot on September 18, 2021, 07:47:42 am
Looks like this bug has been around for 15 years as the following comment was done 15 years ago in app.cpp lines 1472 through 1480:

        // for some reason a mouse up event doesn't make it into scintilla (scintilla bug)
        // therefore the workaround is not to directly call the editorManager, but
        // take a detour through an event
        // the bug is when the file has been offered to reload, no matter what answer you
        // give the mouse is in a selecting mode, adding/removing things to it's selection as you
        // move it around
        // so : idEditorManagerCheckFiles, EditorManager::OnCheckForModifiedFiles just exist for this workaround
        wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, idEditorManagerCheckFiles);

Hope this is of some use to someone who knows allot more about the code than I do.
Title: Re: FLUID and mouse selection
Post by: BlueHazzard on September 20, 2021, 09:19:28 am
.... i member to have looked into this, but obviously found no solution...