Sublime Forum

Multi line edit bug

#1

When I try to edit on multiple line with the “ctrl+command+L”, the caret of each line are at different position.

Here, I tried to have the caret after the 26 to do some edition. But I get only the last one at the correct place and the two first one at the end of the line.

I would like to have it behave like in textmate. The position at the beginning of the selection and the end position define the carets position. If they are not aligned it makes a multiline selection with the carets located at the end position of the selection.

0 Likes

#2

That’s by design. You can try shift+control+up (or down) to keep the cursors in a column. Or you can press option+command+left click to position the cursor wherever you want. Additionally, you’re selecting the same text, you can press command+D multiple times.

0 Likes

#3

Thanks for this information! I had to disable some shortcuts in OS X for this to work. Using shift+control+up is just like highlighting some text in Textmate and tapping the options key to place you in column edit mode.

However, I cannot seem to get ‘Shlit Into Lines’ to work very well for me in ST2

0 Likes

#4

Not sure if this is related problem, but here is the problem I am facing:


Steps to reproduce:

  1. Command + A to select all
  2. Command + Shift + L to start column edit
  3. Command + “Left Arrow” to go to beginning of lines
  4. Note that line 17 was in incorrect position

My question is: how to correctly select all line beginnings in a document, without getting the wrong line selected on line 17?

Good to see the recent sublime update… I really like the the editor (much faster than Atom), but this issue is the one that keeps me from making purchase of the software.

Here is the content of the file for your reference:

HTTP/1.1 500 Internal Server Error
Server: nginx
Content-Type: application/json
Cache-Control: public, s-maxage=600
X-Status-Description: OK
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET,POST,PUT
Access-Control-Allow-Headers: X-API-Version,Accept,Content-Type
Accept-Ranges: bytes
Date: Wed, 13 Sep 2017 13:35:17 GMT
Via: 1.1 varnish
Connection: keep-alive
X-Served-By: cache-hkg17920-HKG
X-Cache: MISS
X-Cache-Hits: 0
X-Timer: S1505309717.087971,VS0,VE304
Vary: Accept-Encoding, User-Agent, Accept, X-Requested-With, X-Forwarded-Proto, X-Geoip-Country

0 Likes

#5

There are a couple of things at play here kicking you in the butt.

Firstly, when you have word wrap enabled as you do here, pressing Home (or Cmd+Left on MacOS) you jump to the start of the current “logical” line and not to the start of the line overall. Presumably that’s to make it easier for actually editing the content of a wrapped line without potentially jumping farther upward when you meant to go left.

However, while text is selected, you can press just Left or Right with no modifier to jump the cursor to the appropriate end of the selection, which in your case would put the cursor to the left the same as the above sequence, except that since it’s using the selection and not the line the cursor ends up where you intended.

If you do that you’ll notice that you still end up with a bit of a problem; as outlined in your video there are a couple of blank lines under the text, and doing a Select All selects the line end on line 18 as well as all of the other lines above it because a blank line is still part of the content. When you split the selection into lines that leaves a cursor on line 18, and pressing left moves it backwards one character, putting it at the end of line 17.

That won’t happen if the file ends with a single blank line (or no blank lines at all); to get around that you need to manually shorten up the selection to not include the blank line before you split it into lines, or select all, split it into lines, and then do Cmd+Shift+Left Click (Alt+Left Click on Windows/Linux) on the cursor on line 18 to remove it from the selection before you take further actions.

0 Likes