Sublime Forum

Pressing tab moves the cursor to the end of page instead of inserting tab

#1

Sometimes on pressing tab button the cursor reaches to the end of the page.
It happens every time after inserting a snippet.
I reinstalled sublime text but the problem still persists. Please help me solve this.

0 Likes

#2

Open the sublime console (ctrl + `) and type sublime.log_commands(True) (press enter after this) & sublime.log_input(True) (press enter after this) and see what get’s logged (command & key binding) when you press tab

0 Likes

#3

No output when I press tab. The cursor just moves to the output window. When I press tab again it jumps to the input area.

0 Likes

#4

Close the console and then press tab in your main document file. Pressing tab when the console is open will toggle between console output & input.

0 Likes

#5

When the tab works correctly it shows, the output is:

key evt: tab
command: insert_best_completion {“default”: “\t”, “exact”: false}

And when I reach end of file on pressing tab, the output is:

key evt: tab
command: next_field

0 Likes

#6

I guess it is the same request as reported on Discord.

For the record:

The snippet content in question is:

#include <bits/stdc++.h>
using namespace std;

int32_t main() {


$1

    return 0;
}

The solution:

You need to replace $1 by $0 to let ST know it’s the final caret position after inserting the snippet.

1 Like