Post by Stefan on Jul 15, 2022 8:02:17 GMT -5
George,
Following your fix to the !XXXX notation when surrounded by other primitives, I've replaced various (Home)(EraseEOL)XXXX sequences with !XXXX.
The KEYMAP dialog "Hints" section mentions the distinction between an unenclosed string (primary command) and a [string] (just text).
I know the !XXXX notation is described somewhere in the Help docs, but I cannot find it under KEYMAP or the Appendix about Keyboard Primitives.
My apologies if this is already explained somewhere, but here goes....
I have a macro (my_FIND) which issues a FIND command for the word under the cursor (Get_Curr_Word$).
The cursor is to be positioned at the next occurence, with the <findstring>, suitably highlited.
The my_FIND command is KEYMAPped to ALT-F like this:
The cursor is to be positioned at the next occurence, with the <findstring>, suitably highlited.
The my_FIND command is KEYMAPped to ALT-F like this:
(SaveCursor)(Home)(EraseEol)[my_FIND](RestoreCursor)(Enter)
This works perfectly, so I figured the replacement would be
(SaveCursor)!my_FIND(RestoreCursor)(Enter)
It didn't work. Unable to locate the relevant HELP info, I experimented with various !XXXX combinations, noting the highlighting and cursor positioning, and concluded...
The !XXXX syntax appears to behave like the sequence (Home)(EraseEOL)XXXX(Enter) even when surrounded by other primitives.
Furthermore, the (Home) primitive changes the logical cursor position, necessitating the use of (SaveCursor) before it and (RestoreCursor) afterwards so the XXXX command finds the cursor where the user left it.
However, the !XXXX notation enters the XXXX command in the cleared command line apparently without changing the logical cursor position. So (SaveCursor) and (RestoreCursor) just muddy the waters.
Hence I found that (SaveCursor)(Home)(EraseEol)[my_FIND](RestoreCursor)(Enter) can actually be replaced by just simply !My_FIND
As far as the documentation is concerned, I recommend some changes so the !XXXX notation is linked / co-located with the Keyboard Primitive descriptions.
Assuming I'm not mistaken, it would also be worth documenting the different effects (Home) and !XXX have on the cursor location.
If you wish to experiment yourself, I attach the my_FIND macro to save you some typing.
my_FIND.macro (2.09 KB)