Sublime Forum

Pasting n lines into n selections

#1

Should the following be considered a bug?

  1. Create this text

1 2 a b

  1. Select the first two lines by placing the caret before “1”, holding down shift, and pressing down arrow twice.
  2. Copy to clipboard (ctrl-c); clipboard has “1\n2\n” on it (one newline after each line copied)
  3. Create two selection regions after “a” and “b” (e.g. move caret after “a”, ctrl-alt-down arrow)
  4. Paste

EXPECTED: Two lines + two selection regions = paired pasting, resulting in “a1” and “b2”
ACTUAL: Treats as a lines/regions mismatch and results in:

[code]a1
2

b1
2

[/code]

WORKAROUND 1: Use multiple selection regions for the copy (e.g. ctrl-shift-l between steps 2 and 3 above)
WORKAROUND 2: Do not copy the final newline when copying multiple lines. (When copying n lines of data, you will have n-1 newlines on the clipboard.)

(Possibly related: performing the step #2 shows “3 lines” in the status bar of Sublime.)

0 Likes