Tab key doesn't switch to source panel while LS-plugin is loading in QV

Please report only one bug per message!

Moderators: sheep, Hacker, Stefan2, white

Post Reply
User avatar
DrShark
Power Member
Power Member
Posts: 1275
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262

Tab key doesn't switch to source panel while LS-plugin is loading in QV

Post by *DrShark » 2019-05-02, 17:43 UTC

This issue discovered during tests for *.ts files viewing bugreport.

To reproduce:
1. Install CudaLister 1.6.7.
2. Download this TS sample file (already mentioned here).
3. If CudaLister isn't loaded for that sample, either apply a workaround with adding a MULTIMEDIA detect string for CudaLister in wincmd.ini, or just change sample file extrension from .ts to .js
4. Open a sample file in Total Commander's Quick View (using Ctrl+Q):
after CudaLister is loaded but before lexer will be fully applied (so text will be highlighted with colors and file folding will appear), a focus switches from source panel to nowhere, so pressing the Tab key will neither activate target panel (QuickView) nor return focus to source panel. Ctrl+Q doesn't work during file loading too.
5. After a file will be fully loaded (folding lines will appear,) Tab key (and Ctrl+Q) will work again.

I consider it as a bug because between opening QuickView and a moment when the file is fully loaded by a plugin it's possible to switch a focus to a source panel using a mouse click, then Tab key immediately starts working again. So I think either in step 4 Total Commander should switch a focus to a target (QuickView) panel immediately, or, if it's not possible, it should allow to return a focus to a source panel using a keyboard (by a single or double click on Tab key.)
Android 4.3.1 no root, kernel 08.09.2016; Vista Home Premium SP2 rus 32 bit
TC #149847 Personal licence

Cuz we're all in this together, We're here to make it right

User avatar
petermad
Power Member
Power Member
Posts: 8544
Joined: 2003-02-05, 20:24 UTC
Location: Valsted, Denmark
Contact:

Re: Tab key doesn't switch to source panel while LS-plugin is loading in QV

Post by *petermad » 2019-05-02, 22:17 UTC

I can confirm this.
If I in the left panel have the sample file parser.ts and I enable QuickView and click on the file and immediately thereafter press Tab, then the Tab key thereafter doesn't seem to work. I can revive it by running the cm_FocusTrg from the command line (or by clicking on the left file panel).

Since I in my Main menu have the commands cm_FocusLeft, cm_FocusRight, cm_FocusSrc and cm_FocusTrg I can actually reveal that TC still recognizes the Tab key:
After the first Tab press, my Focus menu shows this (which is expected): http://madsenworld.dk/tcmd/focuslost1.png
After a second Tab press, my Focus menu shows that the focus is in the right panel (when it should have been in the left panel): http://madsenworld.dk/tcmd/focuslost2.png
If I continue pressing Tab then the focus is either missing or percieved by TC to be in the left panel at every second keypress.

Under normal conditions (where I let CudaListers lexer finish its formatting before I press Tab) it looks like this at every second keypress:
http://madsenworld.dk/tcmd/focuslost3.png and like this at every other keypress: http://madsenworld.dk/tcmd/focuslost1.png (as expected)
License #524 (1994)
Danish Total Commander Translator
TC 9.5b1 32+64bit on Win XP 32bit, Win 7, 8.1 & 10 (1903) 64bit, 'Everything' 1.4.1.935 (x64)
TC 3.0b12 on Android 6.0
Get: Extended Total Commander Menus | PHSM-Calendar

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 37695
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Tab key doesn't switch to source panel while LS-plugin is loading in QV

Post by *ghisler(Author) » 2019-05-06, 08:13 UTC

This cannot be avoided - it happens because Delphi handles the TAB key in its message loop. When a plugin is busy, the Delphi message loop isn't running because the plugin is running its own message loop, so the tab key isn't handled.
Author of Total Commander
http://www.ghisler.com

User avatar
DrShark
Power Member
Power Member
Posts: 1275
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262

Re: Tab key doesn't switch to source panel while LS-plugin is loading in QV

Post by *DrShark » 2019-05-06, 10:50 UTC

ghisler(Author) wrote:
2019-05-06, 08:13 UTC
When a plugin is busy, the Delphi message loop isn't running because the plugin is running its own message loop, so the tab key isn't handled.
I'm not a programmer, but maybe it's possible to avoid going to plugin's message loop while it's busy opening file, so it will be possible to fix "Open ... Quick View (using Ctrl+Q): ... focus switches from source panel to nowhere" issue while plugin is busy? If can you detect this, maybe you can make the focus (cursor) on file to stay active in source panel while plugin will be busy opening a file in opposite panel's QuickView, and after plugin will fully open a file, you can activate target (QuickView) panel.
Android 4.3.1 no root, kernel 08.09.2016; Vista Home Premium SP2 rus 32 bit
TC #149847 Personal licence

Cuz we're all in this together, We're here to make it right

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 37695
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Tab key doesn't switch to source panel while LS-plugin is loading in QV

Post by *ghisler(Author) » 2019-05-06, 19:25 UTC

I could call the plugin from a background thread, but not all plugins are thread safe...
Author of Total Commander
http://www.ghisler.com

User avatar
DrShark
Power Member
Power Member
Posts: 1275
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262

Re: Tab key doesn't switch to source panel while LS-plugin is loading in QV

Post by *DrShark » 2019-05-07, 10:55 UTC

ghisler(Author) wrote:
2019-05-06, 19:25 UTC
I could call the plugin from a background thread, but not all plugins are thread safe...
In my above suggestion I meant to leave file cursor active in source panel while plugin is busy opening file (currently we press Ctrl+Q -> cursor immediately disappears from source panel and will appear there again only after plugin will fully load a file). Is calling a plugin in background thread can only be a solution to this? As petermad wrote, cm_FocusSrc works while plugin is loading a file: a menu or a button with cm_FocusSrc makes cursor to appear in source panel while plugin is busy, so maybe TC can just execute this command internally after user pressed Ctrl+Q and cursor disappeared?
Android 4.3.1 no root, kernel 08.09.2016; Vista Home Premium SP2 rus 32 bit
TC #149847 Personal licence

Cuz we're all in this together, We're here to make it right

Post Reply