Repository navigation
Conversation
With "use_os_color_picker" on, the picker call blocked the plugin host's main thread until the native dialog closed, so Sublime showed "Not Responding" for as long as the dialog stayed open (125 s in one test on Windows) and every other package in the same plugin host stopped with it. Run the dialog on a worker thread and hand the result back with sublime.set_timeout. Because the editor now stays usable while the dialog is open, remember where the picker was started (a hidden region that follows edits) and put the result there afterwards: back in the original view, with the original selection, or nowhere if that view was closed. Each invocation uses its own region key, and a second request while a dialog is open only shows a status message. Tested with the stock release as baseline (freeze reproduced and fixed) on Windows and with kcolorchooser under WSL: OK and Cancel, edits and a moved caret while the dialog is open, switching tabs, closing the file, plugin reload and package unload with the dialog open, overlapping dialogs, and the built-in picker (use_os_color_picker false) unchanged. macOS is untested. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QrLXeSos7CbhMgJJponrpj
|
This actually seems promising. I'll play with it a bit more, and if I can't find any weird edge cases, I'll merge it in. I'll take care of any refactoring if required. |
The picker now runs on a worker thread, so an exception there no longer reaches the main thread and was swallowed. Print the traceback to the console and show a status-bar message. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TUDTsjkUebDhyzXUW1bYjj
|
Claude reports: I pushed one small follow-up commit to this branch. The picker now runs on a worker thread, so an error raised inside it no longer reached the main thread and was swallowed. The commit prints the traceback to the console and shows a status-bar message ("ColorHelper: the color picker failed, see the console"). It is 7 lines in Since the first push, tested on Windows with the real dialog: one and several cursors, text typed while the dialog is open, the file closed or the tab switched while it is open, the plugin reloaded while it is open, a second window open, and a second request while a dialog is open (it is ignored with a status message). Each case restored the selection correctly and cleared the busy flag, with no errors in the console. macOS is still untested. |
Claude reports: the native color picker (
ChooseColorWon Windows,osascripton Mac,kcolorchooseron Linux) blocks until the dialog closes. While it was open, the plugin host froze. This runs the picker on a worker thread and returns the result on the main thread. The result goes back to the colour that was selected when the picker started, even if the cursor moved or the text changed meanwhile. A second request while a dialog is open is ignored with a status-bar message. Onlych_panel.pychanges. Tested on Windows (Sublime 4215) and Linux (WSL,kcolorchooser). Not tested on macOS. Discussion #283.