[markdown] Add key shortcuts for shifting left or right a line or selected text
In a disscussion, we talked about being able to indent/shift a line or selected text left or right while editing markdown.
Outside of changing list hierarchies, being able to indent/shift a line of text, or a group of selected text, is very helpful in markdown editing. If you need to get a block quote to appear in a list, then you have to space it over. Same way with paragraphs. You copy/paste something from somewhere else, and if the editor is not doing some type of intelligent indenting, then chances are you may need to shift the entire text - either to the right, or to the left.
Happens all the time when I paste code. The original code can be very indented, but when I past it in, many times I want to remove some of that indentation, just to make it look cleaner.
Also, since code lines can be triggered by 4 leading spaces in markdown, being able to paste a line from somewhere and quickly shift right twice saves me from having to add the triple backticks.
The difficulty comes in choosing what keys to use. In many editors, both tab
/shift-tab
and cmd-]
/cmd-[
perform the same function - shifting the line or selected text to the right or left. Sometimes, pressing tab
works for inserting some space, but if any text is selected, it erases it. Or shift
is used to insert a couple spaces at the insertion point, rather than shifting the entire line.
So I've found more consistency in cmd-]
/cmd-[
, at least for shifting lines.
Of course in a browser, both tab
/shift-tab
and cmd-]
/cmd-[
have default behaviors.
tab
takes you to the next accessibility field. I think this is a little harder, usability/accessibility wise, to override. Once you're done editing a form field, the accessible way to go to the next field is via tab
Using cmd-]
/cmd-[
takes you back and forth in the browser history for the browser tab you're currently in. I feel like these are easier to commandeer in an edit field. I'm sure there might be a use case for using them when editing a field (maybe toggling back and forth between the previous page and the current one?) but I've found it much less likely.
So I would propose to use cmd-]
/cmd-[
for indenting/shifting text. Not only does this allow you to shift pasted in text, but also allows you to create a sublist easily (along with #23977 (closed)).
Related to #23978.