BookmarkSubscribeRSS Feed

Keyboard shortcuts that moves the caret to the beginning and end of a selection would be incredibly useful in creating keyboard macros, especially for things like quoting or commenting a specific selection. The current shortcut to comment selections is impractical for most daily uses. 

 

Instead of 

 

/*comment blah*/

/*blah*/

/*blah*/

 

The shortcut could be used to create a macro that does this

 

/*comment blah

blah

blah*/

 

 

SOLVED! Thanks @CaseySmith! I knew the arrow keys will take you to the beginning or end, but I was trying to express a shortcut that essentially did both simultaneously, for use in the macro recorder. Your solution of just copying the selection and pasting solves this issue perfectly! It seems so obvious now, thank you for pointing that out!

 

4 Comments
paulkaefer
Lapis Lazuli | Level 10

Great suggestion! Also would come in handy when running a large section of code and needing to change a variable at the top. I would use this shortcut frequently.

 

I have seen this ability in other editors/IDEs. Something simple like the arrow keys or home/end would be nice.

CaseySmith
SAS Employee

Thanks for the suggestion.  Please help me understand the idea...

 

Currently, if there is a selection and you press the left arrow, the caret moves to the beginning of the selection and the selection is cleared.  If there is a selection and you press the right arrow, the caret moves to the end of the selection and the selection is cleared.  Are you asking for a way to edit the text within the selection without losing the selection?

 

If you aren't concerned about retaining the selection (and the fact that it overwrites your clipboard and doesn't behave well when no selection), you can accomplish "quoting the entire selection with one set of comment markers" with a keyboard macro such as the following:

 

commentKeyboardMacro.png

 

Casey

 

paulkaefer
Lapis Lazuli | Level 10

I was mistaken; I thought if you had a selection highlighted and used the arrow keys, it would only impact the location where the cursor was last, not the selection start/end points.

 

Thanks, @CaseySmith!

fifthand57th
SAS Employee
Status changed to: Suggestion Implemented