Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: SelectStart and SelectEnd commands (for use in Macros); or FindSelect #5383

Closed
hi5 opened this issue Jan 24, 2024 · 5 comments
Closed

Comments

@hi5
Copy link

hi5 commented Jan 24, 2024

I don't think they are available or I'm looking for the wrong terms, but for use in Macros I thought it would be helpful to have SelectStart and SelectEnd commands, that way we can find a starting point, SelectStart, find the end and SelectEnd - now we have selected the text between our start and ending points.

Alternative could be a FindSelect* so you can first find your starting point, and them find your end point while selecting all text in between.

Or add all three: SelectStart, SelectEnd, and FindSelect*

Other suggestions welcome.

@Alexey-T
Copy link
Owner

Alexey-T commented Jan 24, 2024

This can be done by mouse already:

  • click at start-point
  • scroll to some place
  • Shift+click at end-point

@Alexey-T
Copy link
Owner

Alexey-T commented Jan 24, 2024

I forgot about MARKERS. your wish can be done with markers:

  • put caret on select-start, call 'markers: drop marker at caret' from Command Palette
  • put caret to select-end
  • call 'markers: select to last marker'

@Alexey-T Alexey-T added talk and removed plugins labels Jan 24, 2024
@hi5
Copy link
Author

hi5 commented Jan 24, 2024

Ah yes, Markers, that might do it. Alas they are not recorded in the Macros it seems.

It is also a pita you can't edit the macros in the macro-gui, but that is another problem :)

My purpose is (as an example) that I have a line of html (where | is the caret position):
<p>Lorem ipsum <b>dolor sit |amet</b>, consectetur adipiscing elit.</p>
Now run the macro to select the text within the bold tag e.g. dolor sit amet
I do a findprevious >, start select (Drop marker), do a findnext <, then select cmd_Markers_SelectToCaret
Is there an obvious mistake I'm making?
When I record it only records the findprevious/findnext and KeyRight/Left commands.

Edit: found the error in my code, I forgot to insert cmds. for the manually added commands. Works now!
When I modify the macro code to include the cmd_Markers_DropAtCaret and cmd_Markers_SelectToCaret it doesn't seem to generate the result I expect (or am hoping for)

"ed.cmd(cmds.cmd_FinderAction,'findprev\\x01>\\x01\\x01faA')",
"ed.cmd(cmds.cCommand_KeyRight)",
"ed.cmd(cmds.cmd_Markers_DropAtCaret)",
"ed.cmd(cmds.cmd_FinderAction,'findnext\\x01<\\x01\\x01faA')",
"ed.cmd(cmds.cCommand_KeyLeft)",
"ed.cmd(cmds.cmd_Markers_SelectToCaret)"

@Alexey-T
Copy link
Owner

Alexey-T commented Jan 24, 2024

made the fix in app. now all cmd_Markers* commands are recorded to macros. I don't know why it was disabled.... tested with Macros plugin - such commands are recorded now.

@Alexey-T Alexey-T added enhancement and removed talk labels Jan 24, 2024
@hi5
Copy link
Author

hi5 commented Jan 24, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants