Sublime Forum

Dev Build 3156

#9

@levacic, the fixed regression was with another command on the vintage mode, which must not keep the initial text selected. @wbond should be talking about that other command when he said:

Up until build 3153 the command palette would not select initial text

Perhaps he meant to say:

Up until build 3153 the vintage command would not select initial text

The problem here is that the fix for that vintage command, also make the command palette not select the initial text, i.e., the fix to a regression, created another regression.

2 Likes

#10

As I can deduce, you want the command palette empty when invoked. You can use following workaround to get the behavior you wanted. This plugin is slightly modified version of what is posted by @addons_zz

import sublime
import sublime_plugin

class DeselectCommandPaletteTextCommand(sublime_plugin.WindowCommand):
    def run(self):
        self.window.run_command("show_overlay", {"overlay": "command_palette"})
        self.window.run_command("select_all")
        self.window.run_command("left_delete")

Then add this line to your default keybindings:
{ "keys": ["ctrl+shift+p"], "command": "deselect_command_palette_text" },

0 Likes

#11

To echo @levacic and support what @addons_zz said, I have also been a sublime user for 5+ years and something has most definitely changed in this build as whatever I have been doing for 5+ years no longer works. Which is to say, typing Ctrl-Shift-p and then directly typing a command no longer works.

@bantya, the palette doesn’t have to be empty and probably shouldn’t be because then it is forgetting my previously type command, which is often the command I want to repeat. However, if the text is selected by default and I start typing it gets replaced with whatever new command I want. That is, with selected text I get both my previous command readily accessible and can immediately type any new command.

8 Likes

#12

Up until build 3153 the command palette would not select initial text

This is not true. I just tried it using ST 3126.

  1. Open command pallet -> input is empty
  2. Enter a command and execute it
  3. Reopen command pallet -> previous command is displayed in input control and fully selected

So I can either type enter again to recall it or just start typing another command.

If the command pallet is canceled without running a command, the input is cleared.

As @levacic I stumbled with the new behavior, too. It now requires us to press backspace several times to delete the previously run command in order to be able to run a new one. This is kind of stupid.

Maybe I am misled, but the only discussions I can remember were related to “command pallet not remembering the last command” or something like that.

From my point of view, the most recent run command should always stay in the input control being fully selected no matter whether the command pallet was closed with or without running it the last time. This way the most recent run command can always be executed again by just pressing enter or a new one can be typed in.


And maybe in the future the first lines of the search result list may be dedicated to the most recently run commands matching the fuzzy search, in order to ease up working with a couple of commands only. Sometimes one needs to call one or two commands after each other. Having some kind of favorites built from command history might help to quickly find them.

9 Likes

#13

Long key binding hints are cut off.

4 Likes

#14

Sorry, the fix was for when the text arg was passed to show_overlay, but it appears that I also managed to have it apply in this other situation. The intent is to preserve the behavior before the Command Palette was enhanced with the new functionality. I’ll get this kink worked out in the next build.

20 Likes

#15

Default settings on Windows 10. Scrolling yields 100% CPU usage and about 4 screenupdates per second, when scrolling in the attached file. The Minimap also shows a wrong position.

Behaviour is normal when turning Word Wrap off.

Examplefile: http://s000.tinyupload.com/?file_id=78365722612302444015

0 Likes

#16

is this problem new in this build? if not, it probably doesn’t belong on this thread - if it’s not a regression or discussion about changes in this build, maybe make a separate thread for it

2 Likes

#17

Echoing the same sentiment as others have stated. Ctrl-Shift-P, felt broken and awkward after this build. Whether this was to fix a previous regression or an explicit change in behavior, the previous behavior with the previous command text selected just felt “right” - You can simply hit Enter to re-run the previous command, or immediately start typing to run a new command.

0 Likes

#18

If you read up three posts, you’ll see the situation you are speaking about was a mistake and we’ll be correcting it in the next build.

3 Likes

#19

My bad. Glad it’s getting fixed. Thanks

0 Likes

#20

Anyone getting issues with 3156 and copy and paste? I’m on Windows 10 and I get:

Unable to extract text form the clipboard, available formats: DataObject, TGerminal Services Private Data, Ole Private Data
0 Likes

#21

Never mind. Seems to be my whole system has clipboard messed up…sigh

0 Likes

#22

Thanks @wbond for corrections about Command Palette. In other news…

Have multiple cursors somehow changed? Seems like Alt-shift-up and -down aren’t working with this build with default keybindings. If I copy the default bindings to my user settings they do work.

Also, should I be creating actual issues for these things or is it okay to sound them out here in the release message thread?

0 Likes

#23

I don’t think anything has changed on them recently. Certainly not with build 3156.

0 Likes

#24

This is the symptom when some package is overriding your keybindings, as:

  1. Any package can override the default keybind
  2. The User .sublime-keymap file override all the packages key binds

Do help diagnose, you can enable/disable the Sublime Text logging with:

sublime.log_input(True); sublime.log_commands(True); sublime.log_result_regex(True)
sublime.log_input(False); sublime.log_commands(False); sublime.log_result_regex(False)

After enabling the log, press the keys and see if some command is issued on the Sublime Text console.

If it is a regression with this build, could post here or perhaps open a new issue, if you think is a too complicated/long discussion.

0 Likes

#25

It feels like I am blind. Maybe one of you can help me out.

I try to create a command which opens the new command pallet and lists all package settings files except existing syntax-settings. But somehow it keeps throwing an exception.

>>> sublime.run_command("my_input")
Traceback (most recent call last):
  File "C:\Apps\Sublime3\3156\sublime_plugin.py", line 934, in run_
    return self.run()
TypeError: run() missing 1 required positional argument: 'base_file'

It looks like the input() method of the MyInputCommand is not executed at all.

Not working piece of code

import re
import os

import sublime
import sublime_plugin

# import Default.settings

PACKAGES = "${packages}/"

# The pattern to extract the path and basename of a file without OS pattern.
SETTINGS_RE = re.compile(
    r"(?i)Packages/(.+/)(.+?)(?: \(.+\))?(\.sublime-settings)")
SYNTAX_RE = re.compile(
    r"(?i)Packages/(.+/)(.+?)(?: \(.+\))?(\.sublime-syntax)")


class BaseFileInputHandler(sublime_plugin.ListInputHandler):

    def name(self):
        return "base_file"

    def placeholder(self):
        return "Settings File"

    def preview(self, value):
        if value:
            return sublime.Html("<b>File:</b> " + value[len(PACKAGES):])
        else:
            return None

    def list_items(self):
        syntaxes = set()
        for f in sublime.find_resources('*.sublime-syntax'):
            _, name, _ = SYNTAX_RE.match(f).groups()
            syntaxes.add(name)

        items = set()
        for f in sublime.find_resources('*.sublime-settings'):
            path, name, ext = SETTINGS_RE.match(f).groups()
            if 'User' not in path and name not in syntaxes:
                items.add(("📑 " + name, "".join((PACKAGES, path, name, ext))))

        items = list(items)
        items.sort()
        return items


class MyInputCommand(sublime_plugin.ApplicationCommand):

    def input_description(self):
        return "Preferences"

    def input(self, args):
        if "base_file" not in args:
            return BaseFileInputHandler()
        else:
            return None

    def run(self, base_file):
        print(base_file)

There is another function to override the syntax specific settings which works fine.


class SyntaxSettingsInputHandler(sublime_plugin.ListInputHandler):

    def __init__(self, syntax):
        self.syntax = syntax

    def name(self):
        return "syntax"

    def placeholder(self):
        return "Syntax Name"

    def list_items(self):
        items = set()
        selected = None
        for f in sublime.find_resources('*.sublime-syntax'):
            path, name, ext = SYNTAX_RE.match(f).groups()
            if name == self.syntax:
                caption = "📑 " + name + " (this view)"
            else:
                caption = "📑 " + name
            item = (caption, name)
            if name == self.syntax:
                selected = item
            items.add(item)

        items = list(items)
        items.sort()
        return (items, items.index(selected)) if selected else items


class EditSyntaxSettingsCommand(Default.settings.EditSyntaxSettingsCommand):

    def input_description(self):
        return "Syntax Settings"

    def input(self, args):
        if "syntax" not in args:
            try:
                settings = self.window.active_view().settings()
                syntax, _ = os.path.splitext(os.path.basename(settings.get('syntax')))
            except:
                syntax = None
            return SyntaxSettingsInputHandler(syntax)
        else:
            return None

    def run(self, syntax):
        self.window.run_command(
            'edit_settings',
            {
                'base_file': '${packages}/Default/Preferences.sublime-settings',
                'user_file': os.path.join(sublime.packages_path(), 'User', syntax + '.sublime-settings'),
                'default': (
                    '// These settings override both User and Default settings '
                    'for the %s syntax\n{\n\t$0\n}\n') % syntax
            })

    def is_enabled(self):
        return True
0 Likes

#26

Yup, that was the problem. Thanks @addons_zz. Forgot I had installed Compare Side-By-Side right at the same time.

1 Like

#27

It does not work, because if I recall correctly, they do not implemented yet the ability to call the new input handlers outside the command palette as a command.

I made your example work, by creating a Default.sublime-command within:

  { "caption": "11111 My Input",
    "command": "my_input",
  },

Then, after opening the command palette and calling your command, it opened this:

0 Likes

#28

I believe that what @deathaxe is trying to do will work (that is, using run_command to run a command and have it prompt for input), but for it to work the command has to appear in the command palette as well.

0 Likes