Last active
November 12, 2016 14:04
-
-
Save mattst/1a7a194a76dd8e4f34b86cd3c3ff048c to your computer and use it in GitHub Desktop.
ST plugin to try to reproduce r-stein quick panel bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# { "keys": ["ctrl+whatever"], "command": "example" }, | |
# { "keys": ["ctrl+whatever"], "command": "example_two" } | |
import sublime, sublime_plugin | |
# ********************* | |
# WindowCommand Version | |
# ********************* | |
class ExampleCommand(sublime_plugin.WindowCommand): | |
def run(self): | |
self.items = ["a", "b", "c"] | |
self.window.show_quick_panel(self.items, | |
self.on_done, | |
sublime.KEEP_OPEN_ON_FOCUS_LOST) | |
def on_done(self, index): | |
if index == -1: | |
msg = "You cancelled the quick panel" | |
else: | |
msg = "You selected: %s" % self.items[index] | |
sublime.status_message(msg) | |
class ExampleTwoCommand(sublime_plugin.WindowCommand): | |
def run(self): | |
self.items = ["d", "e", "f"] | |
self.window.show_quick_panel(self.items, | |
self.on_done, | |
sublime.KEEP_OPEN_ON_FOCUS_LOST) | |
def on_done(self, index): | |
if index == -1: | |
msg = "You cancelled the quick panel" | |
else: | |
msg = "You selected: %s" % self.items[index] | |
sublime.status_message(msg) | |
# ************************** | |
# ApplicationCommand Version | |
# ************************** | |
# class ExampleCommand(sublime_plugin.ApplicationCommand): | |
# def run(self): | |
# self.items = ["a", "b", "c"] | |
# window = sublime.active_window() | |
# window.show_quick_panel(self.items, | |
# self.on_done, | |
# sublime.KEEP_OPEN_ON_FOCUS_LOST) | |
# def on_done(self, index): | |
# if index == -1: | |
# msg = "You cancelled the quick panel" | |
# else: | |
# msg = "You selected: %s" % self.items[index] | |
# sublime.status_message(msg) | |
# class ExampleTwoCommand(sublime_plugin.ApplicationCommand): | |
# def run(self): | |
# self.items = ["d", "e", "f"] | |
# window = sublime.active_window() | |
# window.show_quick_panel(self.items, | |
# self.on_done, | |
# sublime.KEEP_OPEN_ON_FOCUS_LOST) | |
# def on_done(self, index): | |
# if index == -1: | |
# msg = "You cancelled the quick panel" | |
# else: | |
# msg = "You selected: %s" % self.items[index] | |
# sublime.status_message(msg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
An error example would be opened twice in the same window:
The behavior: