[TC 11.00b1] Cursor position wrong when renaming file

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

p.tingen
Junior Member
Junior Member
Posts: 22
Joined: 2007-09-25, 05:52 UTC
Location: Netherlands

[TC 11.00b1] Cursor position wrong when renaming file

Post by *p.tingen »

Take any file, eg "Example File.txt".
I'll show selected text between square brackets, the cursor as pipe

1. Select a file and press F2 for rename
The whole filename except extension is now selected, cursor is right before the dot: "[Example File]|.txt"

2. Press cursor-right or anything to deselect the selected text. Cursor still before the dot: "Example File|.txt"

3. Press shift+ctrl+cursor-left to select the word "File": "Example [File]|.txt"
Cursor remains right before the dot, whereas it should be right before the selection

4. Press shift+cursor-left to select extra letters at the left
Since the cursor is at the end, the selection gets smaller instead of larger: "Example [Fil]|e.txt"

See all steps in one image: https://i.imgur.com/tPJzwMl.png

Win10, 21H2, build 19044.2846
User avatar
white
Power Member
Power Member
Posts: 4617
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.00b1] Cursor position wrong when renaming file

Post by *white »

Step 1 is not default functionality, but I can confirm the issue.

Alternative step 1:
1. Press Shift+F6 twice.

Probably caused by this change:
HISTORY.TXT wrote: 03.04.23 Added: In place rename, command line: Stop at more non-alphanumeric characters on Ctrl+Left/Right: \/(),.;=''^+-%&!_[ ]{} (32/64)
User avatar
petermad
Power Member
Power Member
Posts: 14793
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 11.00b1] Cursor position wrong when renaming file

Post by *petermad »

Confirmed - this worked as expected in TC 10.52
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.00b1] Cursor position wrong when renaming file

Post by *ghisler(Author) »

Unfortunately this is impossible: The range is set with EM_SETSEL, but the cursor is always placed at the end of the range, whether you send the left or the right position as the first parameter. Either it stops at the extra characters, or the control handles it and then only stops at a few as in 10.52. :(
Author of Total Commander
https://www.ghisler.com
User avatar
AntonyD
Power Member
Power Member
Posts: 1246
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: [TC 11.00b1] Cursor position wrong when renaming file

Post by *AntonyD »

The range is set with EM_SETSEL, but the cursor is always placed at the end of the range, whether you send the left or the right position as the first parameter.
Note that you can make the second call to EM_SETSEL with the same start and end position which will set the cursor position to the start of the selection range. If you want to set the cursor position to the end of the selection range, you can use the second EM_SETSEL message with the end position as both the start and end parameters.
#146217 personal license
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.00b1] Cursor position wrong when renaming file

Post by *ghisler(Author) »

Unfortunately this doesn't work, I have just tried it: When I do this, the cursor is indeed moved to the start of the selection, but at the same time the selection gets removed.
Author of Total Commander
https://www.ghisler.com
ymmv
Junior Member
Junior Member
Posts: 34
Joined: 2004-03-06, 12:22 UTC

Re: [TC 11.00b1] Cursor position wrong when renaming file

Post by *ymmv »

My problem is not the cursor position, but the simple fact that if you press Shift+F6 to rename a file like "example file.txt" (which selects all words before the dot), pressing shift-ctrl-cursor_left should deselect the word "file", but now nothing happens. Cursor doesn't move, text isn't deselected.

This worked fine in 10.52 and all previous TC versions.
User avatar
AntonyD
Power Member
Power Member
Posts: 1246
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: [TC 11.00b1] Cursor position wrong when renaming file

Post by *AntonyD »

2ymmv
pressing shift-ctrl-cursor_left
and now try to use shift-ctrl-cursor_right ;) and see what is happening....
All problems here is indeed from wrong position of that cursor(((((
Last edited by AntonyD on 2023-05-06, 07:12 UTC, edited 2 times in total.
#146217 personal license
User avatar
AntonyD
Power Member
Power Member
Posts: 1246
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: [TC 11.00b1] Cursor position wrong when renaming file

Post by *AntonyD »

2ghisler(Author)
Unfortunately this doesn't work
BUT - as I remember and understand - you already made some changes in Delphi/Pascal initial source-files. Maybe it's time to make the same? To find in which *.pas component low-level support of editbox is implemented and patch the moment - in which circumstances and where the cursor should be placed....
but the cursor is always placed at the end of the range, whether you send the left or the right position as the first parameter.
this thing at least this trick can fix imho.
#146217 personal license
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.00b1] Cursor position wrong when renaming file

Post by *ghisler(Author) »

No, the trick removes the selection.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4617
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.00b1] Cursor position wrong when renaming file

Post by *white »

This ahk example seems to work though: https://www.autohotkey.com/boards/viewtopic.php?p=178593#p178593

But I think I read somewhere that it only works for multiline controls.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.00b1] Cursor position wrong when renaming file

Post by *ghisler(Author) »

They may be using a rich text control, which seems to support it.

Maybe I should just handle shift+cursor left/right myself too?
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14793
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 11.00b1] Cursor position wrong when renaming file

Post by *petermad »

Maybe I should just handle shift+cursor left/right myself too?
It seems so, if you want to solve the problem (which I think it should be).
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.00b1] Cursor position wrong when renaming file

Post by *ghisler(Author) »

OK, I will handle Shift+Cursor left/right myself too (ignore the displayed cursor position and use my own).

Btw, if you dislike the handling of Ctrl1Shift+Arrow, you can disable it via wincmd.ini, [Configuration]
CtrlArrow=0

But please keep it enabled at least for beta 2 to check whether my own handling of shift+left/right works!
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4617
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [TC 11.00b1] Cursor position wrong when renaming file

Post by *white »

Seems to work OK using TC 11.00 b2 32-bit and 64-bit.
Post Reply