Tampermonkey / tampermonkey

Tampermonkey is the most popular userscript manager, with over 10 million users. It's available for Chrome, Microsoft Edge, Safari, Opera Next, and Firefox.
GNU General Public License v3.0
4.04k stars 414 forks source link

[Editor] Tab key not working for template strings #530

Closed Eccenux closed 6 years ago

Eccenux commented 6 years ago

Steps:

  1. Create a user script.
  2. Add template string (example below).
  3. Use select part of a template string.
  4. Press tab.

Result: No effect. Expected: Selection should increase indentation.

Example code:

    function addCss() {
        var cssText = `
.nux-ux-buttons {
position: fixed;
top: 0;
left: 0;
background: rgba(255, 255, 255, 0.5);
}
.nux-ux-buttons a {
display: block;
padding: .5em;
}
.nux-ux-buttons a:hover {
background: white;
}
`;
        GM_addStyle(cssText);
    }
    addCss();
tophf commented 6 years ago

You can use Ctrl[ and Ctrl] instead. On a Mac the modifier key might be Cmd.

derjanb commented 6 years ago

From my point of view this functions as intended, because adding indent levels modifies the template content, which is OK for CSS, but the editor can't know for what purpose the string will be used.

MrAmericanMike commented 3 years ago

As a reference and for those using (a different keyboard I guess) In my case with an spanish keyboard the combination for this was:

Control + ' and Control + ¡

Neutrino-Sunset commented 7 months ago

Why in God's name do I need to press CTRL+[ in order to get a tab! And is there any way to configure it so that the tab key does what it does in every other editor I've ever used?

I've spent an hour trying to work out why the editor is broken!

derjanb commented 7 months ago

@Neutrino-Sunset You're searching for Settings > Editor > TabMode

Neutrino-Sunset commented 7 months ago

Thanks, found it in the end. Pretty confusing though, especially as the setting isn't even visible in the default settings mode of novice.

Also, none of the TabMode settings make it behave like a normal tab key. Smart is the closest, but even then SHIFT+Tab does not unindent one tab at a time but instead just jumps to wherever it wants to.

Wierdest UX design I've seen a long time.