Option to remember the caret position in the command line
Posted: 2024-01-27, 10:30 UTC
Currently, if there is already text in the command line, that text is selected and the caret is placed at the end of the text when the command line gets focus with for example Shift+RigthtArrow or cm_FocusCmdLine or by clicking it with the mouse.
Often one have the need to insert, rather than append, text or filenames in the command line, and for that the current behavior is not always expedient. (If I want the file name appended by for example Ctrl+Enter placed in another position, I have to copy-paste is to the desidered place)
If TC could remember the last caret position when loosing focus, then that position could be used as the point of insertion when pressing Ctrl+Enter, Ctrl+Shift+Enter or Ctrl+P - or when the command line recieves focus.
Currently Shift+LeftArrow and Shift+RightArrow has the same function I imagine Shift+RightArrow could keep it's current behavior with selecting all text an placing the caret at the end of the text, but Shift+LeftArrow could put the caret at the saved position with no text selection.
The behavior could either be chosen via a setting like CommandlineInsertion=1 in wincmd.ini (preferable), or the commands cm_FocusCmdLine, cm_AddPathToCmdline, cm_AddFileNameToCmdline, and cm_AddPathAndFileNameToCmdline could all be provided with a parameter 1 which would use the remembered caret position.
This request is in line with this other request: https://ghisler.ch/board/viewtopic.php?p=437089#p437089
Often one have the need to insert, rather than append, text or filenames in the command line, and for that the current behavior is not always expedient. (If I want the file name appended by for example Ctrl+Enter placed in another position, I have to copy-paste is to the desidered place)
If TC could remember the last caret position when loosing focus, then that position could be used as the point of insertion when pressing Ctrl+Enter, Ctrl+Shift+Enter or Ctrl+P - or when the command line recieves focus.
Currently Shift+LeftArrow and Shift+RightArrow has the same function I imagine Shift+RightArrow could keep it's current behavior with selecting all text an placing the caret at the end of the text, but Shift+LeftArrow could put the caret at the saved position with no text selection.
The behavior could either be chosen via a setting like CommandlineInsertion=1 in wincmd.ini (preferable), or the commands cm_FocusCmdLine, cm_AddPathToCmdline, cm_AddFileNameToCmdline, and cm_AddPathAndFileNameToCmdline could all be provided with a parameter 1 which would use the remembered caret position.
This request is in line with this other request: https://ghisler.ch/board/viewtopic.php?p=437089#p437089