Swap Lines Bugs

Steps to reproduce

Swapping lines using keyboard shortcuts bound to command palette command

Expected result

  1. Unordered list items simply swap position, with bullets keeping the same indentation as before.
  2. 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

  1. Bullets sometimes become asterisks when moved past a bullet that is on another level. No discernable pattern. Sometimes the indentation changes as well.
  2. 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.

Environment

  • Operating system: Windows 10

  • Obsidian version: 0.7.4

Additional information

Video of some of the issues can be found here, along with a video of how I would expect it to behave (demonstrated in OneNote) https://1drv.ms/u/s!AnOEodAV8WChg7tr1Vq5bzNtk8W1uA?e=4bQFug

1 Like

Some of the thigs you report aren’t bug but the way markdown works.

Some of the things you report are also releted to the smart indent functionality. Do you have it on or off?

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 :wink: ?

Either way, the bullet -> asterisk problem seems to remain.

Yeah, some of the issues you see are more releted to making the smart indend smarter than problems with line swap.

It’s tricky a thing and I don’t promise that we’ll fix everything right away.

Thanks. I’ll try to work around it as best I can. Extremely glad to have this as a feature now!

Shifting (swapping) lines up/down does not work as expected.
2020-10-10 observation updated in post below.
related: Include nested content when swapping or moving FOLDED sections

1 Like

Line swapping is still basically unusable with the latest version (0.8.12).

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.

1 Like

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.