Sublime Forum

TAB key deletes selected text - sometimes

#1

Please help me!

I do not understand why sometimes the selected text gets replaced when pressing TAB key.

I searched google about this problem in Sublime Text and found nothing.
One of my friends sais to me that even his Notepad++ does the same from time to time.
Is it from windows? Am I pressing any key or combination while using the computer?

0 Likes

#2

If you have more than one line selected, pressing tab will indent every line that is part of the selection by adding a tab character (or equivalent spaces, depending on your setting). If your selection region spans only one single line, the selected text will be replaced with a tab character. If you want to indent a single line, you will need to insert a tab/spaces at the beginning of the line manually (try pressing the home key).

It does seem like there is a bug where tab will trigger auto-complete if the selection region spans only one line and ends after a character that can be auto-completed, but that doesn’t pertain to your question.

0 Likes

#3

Thank you!
It is not that, I am doing everything right.
I select block of code, generally 3-7 lines and soketimes when pressing TAB everything is delected instead of idented.
When it doesn’t work I try all kinds of selection and key combinations without success.
I can solve it only by adding manually TABs in front of every line.
And after a while, same day, it works again.

Maybe autocompletion bug, or maybe Windows OS… what could it be? Maybe it has to do with the type of code that I am trying to ident. I will keep you updated.

0 Likes

#4

Hello ! Same problem here
To try to be clear, when I start ST, it doesn’t happen, but after a while (~15/30min), ST inserts a second tab key after the first one.

So, for exemple, I use a snippet like

console.log($1)  -- <tabTrigger>log</tabTrigger>

after typing “log”, I getsomething like this :

console.log(	);

here is my config :

Windows 8.1 x64 Sublime Text 3 Build 3047

Installed Packages : "DocBlockr", "Emmet", "HTML5", "jQuery", "SFTP", "SideBarEnhancements", "SublimeCodeIntel", "sublimelint"

user settings :

"bold_folder_labels": true,
	"caret_style": "phase",
	"fade_fold_buttons": false,
	"highlight_line": true,
	"highlight_modified_tabs": true,
	"ignored_packages":
	
		"Vintage"
	],
	"line_padding_bottom": 1,
	"line_padding_top": 1,
	"preview_on_click": false,
	"save_on_focus_lost": true,
	"trim_trailing_white_space_on_save": true,
	"wide_caret": true

Key Bindings

{ "keys": "super+v"], "command": "paste_and_indent" }, { "keys": "super+shift+v"], "command": "paste" }, { "keys": "super+shift+r"], "command": "reindent" }

If someone have an idea

0 Likes

#5

I up !

It happens only with ST3 and on windows 8 (8.1)

0 Likes

#6

Same Issue.

Sublime 3 / windows 8.1.

Single line usually indents. Multiple lines will sometime just delete… sometimes not.

0 Likes

#7

Hi guys,

The indentation needs to have a minimum of two lines… if the line is too long, it will break and look like it is more than one line when in reality it has just one line… in this cases indentation deletes the selection instead of indenting.

0 Likes