Sublime Forum

Sublime cancels my tab

#1

tl;dr - When I’m working with html, go to a new line, tab and start typing, Sublime auto deletes my tab as soon as I start typing and my text isn’t where I want it. Please help!

I’m having a problem with Sublime and I’m guessing there’s a fix, I just don’t know what it is. I’m sorry if this has already been answered somewhere else. Also, I’m sorry for the picture links. It only lets me put 1 picture in a topic, as I’m a new user.

Problem:

Whenever I press the tab button, the cursor tabs correctly. Then, when I start typing, it goes backwards to where the above tab is. I want the text to stay where I purposely tabbed it.

Example:

If I’m coding some super simple html, and this is what I have:

https://postimg.org/image/87rd1kc8p/

You can see where my cursor is above. Then, I press tab, and it tabs correctly, just where I want it to, as you can see below:

https://postimg.org/image/4hdj7khi1/

Now, I’m ready to start typing! But, once I start typing, the cursor moves back parallel to the

element, which is NOT what I want to happen (below).

How can I stop this from happening? How can I make sure the text is right where I tabbed it to be?

Please help! Thanks!

sT

0 Likes

#2

this has been reported here before, and I believe there are some tips on how to fix it:

0 Likes

#3

Thanks for the help! Looks like you found a quick fix a while ago here, within the comments.

However, I couldn’t find the folder that the tmPreferences file resides in?

In:

C:\Program Files\Sublime Text 3\Packages

I only see sublime package files, not an HTML folder where the Miscellaneous.tmPreferences file resides.


Also, any chance we can get an official fix on this from the Sublime devs? It could be made into a option in a menu or something.

Thanks

0 Likes

#4

You can use https://packagecontrol.io/packages/PackageResourceViewer to edit/override files from packages

About an official fix from the ST devs, it might help if we report it at https://github.com/SublimeTextIssues/Core/issues - ideally with an MCVE

0 Likes

#5

Got it! Thanks so much.

And I can report that, unless you or someone else wants to. Being new, I’ve never done that before, but I don’t think it would be too hard. Just let me know.

Thanks again!

1 Like

#6

Okay I found a consistently reproducible test case with ST3126 portable:

command: set_file_type {"syntax": "Packages/HTML/HTML.sublime-syntax"}
chr evt: h (0x68)
chr evt: t (0x74)
chr evt: m (0x6d)
chr evt: l (0x6c)
key evt: tab
command: insert_best_completion {"default": "\t", "exact": false}
key evt: down
command: move {"by": "lines", "forward": true}
key evt: down
command: move {"by": "lines", "forward": true}
key evt: down
command: move {"by": "lines", "forward": true}
key evt: tab
command: reindent
chr evt: < (0x3c)

chr evt: < (0x3c) can also be replaced with any character, like chr evt: h (0x68), and it still unindents.

Changing the Packages/HTML/Miscellaneous.tmPreferences file to remove the batchIncreaseIndentPattern key altogether, makes the problem disappear. As does changing the <string> contents to an empty string. Binding Tab to insert {"characters": "\t"} instead of reindent also makes the problem go away, as does moving the regex to increaseIndentPattern (which affects indentation as you type Enter, as opposed to batchIncreaseIndentPattern which should only affect indentation from the reindent command, if I understand right).

Therefore, it seems it is a bug (or some deliberate action which I don’t currently understand) with ST’s implementation of batchIncreaseIndentPattern when typing after the reindent command has been executed on the line.

It can also be reproduced without inserting a snippet by typing:

<html>
<body>

and then Tabany character key

(btw, there’s an Easter egg in this post somewhere :smiley: )

0 Likes

#7

Wow. That’s awesome. Thanks so much for testing and doing that.

Do you mind submitting it to Sublime? I’ve never done it, and if anyone deserves kudos for this, it’s you!

Thanks again,

sT

0 Likes

#8

reported:

3 Likes