Sublime Forum

[Bug] [Crash] "Indentation: convert to tabs" funny business

#1

I found a small bug which crashes Sublime Text.
To replicate it:

  1. create a new document ctrl+n
  2. set tabs size (or spaces) to 4 in the lower right of the screen
  3. make 4 spaces and one character, your document looks now like this:
    ⋅⋅⋅⋅s
    
  4. place your cursor between the third and fourth space ⋅⋅⋅|⋅s
  5. hit ctrl+p and choose ‘Indentation: convert to tabs’
  6. Sublime Text crashes

This happens because as the four spaces are converted to a single tab (one character). As your cursor can not be at the position it was previously (inside the indentation), sublime text tries to move the cursor away. This fails, because Sublime Text tries to move the cursor 2 chars behind the indentation, but the document ends (EOF) after 1 char. So the cursor is moved out of the document and Sublime Text crashes.

*le me feeling like a crazy h4x0r*

2 Likes

#2

confirmed in build 3120 in Windows although I got a hang rather than a crash and for step 5 I used the indentation context menu from the status bar as per step 2. Please could you consider logging this at: https://github.com/SublimeTextIssues/Core/issues

0 Likes

#3

looks like this has been fixed in 3123

0 Likes