Swapping lines using keyboard shortcuts bound to command palette command
Expected result
Unordered list items simply swap position, with bullets keeping the same indentation as before.
Ordered list items swap positions, with numbers keeping the same indentation and numbers being updated to reflect their position in the current sub-indent.
Actual result
Bullets sometimes become asterisks when moved past a bullet that is on another level. No discernable pattern. Sometimes the indentation changes as well.
Numbers sometimes become out of order and mess up the following numbers. Indentation seems to change as well. Also Preview pane don’t always match the number sequence nor indentation in the edit pane.
Thanks for the quick reply. Which things aren’t bugs? Not being able to have a bullet at any indentation? If so, fair enough.
I do have smart indent on - without it, bullets/numbers are not created on the next line, which makes things much slower. Which of the reported issues are accounted for by the Smart Indent feature? Is there any way to make it Smart-er ?
Either way, the bullet -> asterisk problem seems to remain.
It looks like the combination of Shift+Up/Down is changing the text selection before the Control+Shift+Up/Down shortcut is moving the selection up or down.
I can confirm this.
Current behavior: with hotkeys , Ctrl+Shift+Down
Windows7, Obsidian 0.9.2, Smart indentation ON.
With five line text:
1a
2b
3c
4d
5e
Hotkey Ctrl+Shift+Up bound to “Swap line up” with caret in line “4d”:
Behaves as Shift+Up (i.e. selects also portion of line above).
And then swaps [lines involved in selection] with [line above selection].
results in:
1a
3c
4d
2b
5e
with text “c\n4” being selected (\n meaning line wrap).
Hotkey Ctrl+Up bound to “Swap line up” with caret in line “4d”:
Behaves as Up, i.e. caret moves to line above (“3c”).
And then swaps the line “3c” with line above (“2b”).
1a
3c
2b
4d
5e
Swapping down with caret in line “2b” behaves equivalently, i.e. as if Shift+Down or Down precedes swapping lines.
This applies to caret in the middle or the end of line, caret at line beginning is exception not analyzed in detail here.
By my experience Ctrl + Shift + Arrows is used for selecting blocks of text… I’ve always seen Ctrl + Alt + Arrows for line swapping, and this seems to work just fine (full disclosure, I only set the hotkey a few minutes ago).
Just checked, out of the stuff I use regularly VSCode uses Alt + Arrows, Visual Studio, IntelliJ and Notepad++ use Ctrl + Shift + Arrows to swap, and all use Ctrl + Arrows to “scroll” by one line. So there’s precedent for both.
I can also change VSCode’s to Ctrl + Shift + Arrows (and I would think you can use the others with Alt + Arrows), but the former is broken in Obsidian.