Alexey-T / CudaText

Cross-platform text editor, written in Free Pascal
Mozilla Public License 2.0
2.53k stars 173 forks source link

Selection by words doesn't work well when gaining focus, culprit: GitStatus #4808

Closed Vivalzar closed 1 year ago

Vivalzar commented 1 year ago

Steps to reproduce

Expected Outcome

Upon gaining focus, the selection by words should work without delay, like it does when the editor already has the focus.

Alexey-T commented 1 year ago

cannot reproduce - on Linux and on Win7 x64. check it on clean Cud, please.

Vivalzar commented 1 year ago

Oh well, you're right, it works on a fresh install. Here is my setup if you want to debug it (remove the .txt extension): cudatext.7z.002.txt cudatext.7z.001.txt

Alexey-T commented 1 year ago

I got your folder (only replaced cudatext.exe by my local copy 1.184.0). no repro!

all plugins were active (Win10)

Alexey-T commented 1 year ago

so I suggest you to remove plugins one by one, and find the culprit.

Vivalzar commented 1 year ago

It works too with a fresh launch from my work folder.

The culprit is yet again SQLTools. The bug appears when I execute at least one query. Probably caused by the new background thread in this plugin.

Possibly hard to fix...

Alexey-T commented 1 year ago

SQL Tools? yes, i have no idea how/what to fix here. SQLTools don't assign 'events' via install.inf

veksha commented 1 year ago
  • double-click in the middle of a word in the main editor and drag quickly: it doesn't select by words, but by characters. If you wait for 1 second before dragging, it works.

for some reason, user needs to do Triple-Click to focus and select word. (can this be fixed, @Alexey-T?) this is not sql_tools issue, i think. it's global issue inside CudaText.

Example:

Alexey-T commented 1 year ago

for some reason, user needs to do Triple-Click to focus and select word. (can this be fixed, @Alexey-T?) this is not sql_tools issue, i think. it's global issue inside CudaText.

first I need to repro this. as I said, i cannot yet. dbl-click selects a word and next selection - does sel by words.

do you see this probblem on clean Cud?

Alexey-T commented 1 year ago

@veksha I tried to repro on Win10. no repro too. (I put focus to Firefox address field, then dbl-click the Cud.) but I try the clean Cud, ie it opens without files so no plugins are activated yet (i guess some activated plugin can make bad).

veksha commented 1 year ago

unfocus editor not by activating another window, but by activating another panel! or second editor, etc..

Alexey-T commented 1 year ago

ok, activated the

still the same here.

veksha commented 1 year ago

@Alexey-T , please try with saved file.

Alexey-T commented 1 year ago

here I saved 2 dummy texts to new1.c / new2.c and tried again. still the same. Win10.

cu2

are you sure LSP plugin don't meddle here? or another plugin? do you have repro on clean Cud with 2 saved files?

veksha commented 1 year ago

git_status plugin meddle here.

if i increase timer like this, then i can double-click normally, but this adds mini delay when switching between files (git_status works slower):

diff --git a/__init__.py b/__init__.py
index 8a17888..4aa1d50 100644
--- a/__init__.py
+++ b/__init__.py
@@ -165,7 +165,7 @@ class Command:

         self.badge_requests.put(_filename)

-        timer_proc(TIMER_START, TIMERCALL, 70)
+        timer_proc(TIMER_START, TIMERCALL, 150)

     def on_timer(self, tag='', info=''):
         """ * check if thread returned new badge
veksha commented 1 year ago

git_status works on this event:

def on_focus(self, ed_self):
        self.request_update(ed_self, 'on_focus')

maybe remove this ? and replace with on_tab_change~

code for on_tab_change is already present in .py file, but not used from .inf

Alexey-T commented 1 year ago

on_tab_change is similar. bit it's not called when user focuses different panels of UI: editor-> console -> editor. is it better for GitStatus?

veksha commented 1 year ago

i think it's better. who knows. who needs to reread git info on focus? better on tab change.

PS: did you repro dbl-clicking issue with git_status and some saved file?

Alexey-T commented 1 year ago

did you repro dbl-clicking issue with git_status

nope; but I tried it - with 2 readme files from 2 git repos.

Alexey-T commented 1 year ago

OK, let's use on_tab_change.

Alexey-T commented 1 year ago

ops, on_tab_change is not called when I toggle focus between group-1 and -2. not good.

veksha commented 1 year ago

nope; but I tried it - with 2 readme files from 2 git repos

maybe your cpu is faster/slower then mine, so you can't repro it.

Alexey-T commented 1 year ago

I have CPU Intel Core i3 3GHz.

veksha commented 1 year ago

AMD Ryzen 7 2700 Eight-Core Processor 3.20 GHz

veksha commented 1 year ago

@Vivalzar , can you tell who is the culprit now. is it really sql tools? or git_status?

Vivalzar commented 1 year ago

I will test on Monday. I have to update git_status?

veksha commented 1 year ago

I have to update git_status?

no, if you are already have latest version :)

Vivalzar commented 1 year ago

You are right. It's actually git_status which was the culprit. It works now. Thank you.