[TC 11.00b1] Cursor position wrong when renaming file
Moderators: Hacker, petermad, Stefan2, white
[TC 11.00b1] Cursor position wrong when renaming file
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
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
Re: [TC 11.00b1] Cursor position wrong when renaming file
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:
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)
Re: [TC 11.00b1] Cursor position wrong when renaming file
Confirmed - this worked as expected in TC 10.52
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: [TC 11.00b1] Cursor position wrong when renaming file
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
https://www.ghisler.com
Re: [TC 11.00b1] Cursor position wrong when renaming file
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.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.
#146217 personal license
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: [TC 11.00b1] Cursor position wrong when renaming file
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
https://www.ghisler.com
Re: [TC 11.00b1] Cursor position wrong when renaming file
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.
This worked fine in 10.52 and all previous TC versions.
Re: [TC 11.00b1] Cursor position wrong when renaming file
2ymmv
and see what is happening....
All problems here is indeed from wrong position of that cursor(((((
and now try to use shift-ctrl-cursor_rightpressing shift-ctrl-cursor_left

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
Re: [TC 11.00b1] Cursor position wrong when renaming file
2ghisler(Author)
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....Unfortunately this doesn't work
this thing at least this trick can fix imho.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.
#146217 personal license
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: [TC 11.00b1] Cursor position wrong when renaming file
No, the trick removes the selection.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: [TC 11.00b1] Cursor position wrong when renaming file
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.
But I think I read somewhere that it only works for multiline controls.
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: [TC 11.00b1] Cursor position wrong when renaming file
They may be using a rich text control, which seems to support it.
Maybe I should just handle shift+cursor left/right myself too?
Maybe I should just handle shift+cursor left/right myself too?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Re: [TC 11.00b1] Cursor position wrong when renaming file
It seems so, if you want to solve the problem (which I think it should be).Maybe I should just handle shift+cursor left/right myself too?
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
- ghisler(Author)
- Site Admin
- Posts: 50390
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: [TC 11.00b1] Cursor position wrong when renaming file
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!
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
https://www.ghisler.com
Re: [TC 11.00b1] Cursor position wrong when renaming file
Seems to work OK using TC 11.00 b2 32-bit and 64-bit.