sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
801 stars 35 forks source link

The search field get stuck (Ctrl+F) and does not allow changing its input, but the search and replace function (Ctrl+H) is working normally #6194

Open evandrocoan opened 8 months ago

evandrocoan commented 8 months ago

Description of the bug

This was reported on Discord: https://ptb.discord.com/channels/280102180189634562/280157083356233728/1172396415847239710

IGHOR, Whats wrong with the search bar? It is so annoying, happened many times within last few months on macOS version of Sublime Text 4

Peek2023-11-13 18-20-searchbug

I also have had this problem at random with the search bar happening for a few years. I decided to post an issue here. Right now, my sublime text has this bug, but I am not restarting because I have too many Windows open, and it rearranges my taskbar icons. I am not willing to do that right now. Instead, I use the search and replace (Ctrl+H) to find things until I take the time to restart Sublime Text.

Steps to reproduce

I am still figuring that out. It happens randomly after a few days of usage (without restarting/closing Sublime, as the computer is suspended and not shut down).

Expected behavior

The search function (Ctrl+F) does not get stuck indefinitely at random until I restart Sublime Text.

Actual behavior

The search function (Ctrl+F) does get stuck indefinitely at random until I restart Sublime Text.

Sublime Text build number

4121

Operating system & version

Windows 10 and Ubuntu 20

(Linux) Desktop environment and/or window manager

XFCE 4.12

Additional information

It happens both on Windows and Linux, and there is a few years it happens.

OpenGL context information

No response

BenjaminSchaaf commented 8 months ago

Does this happen in safe mode? What packages do you have installed?

evandrocoan commented 8 months ago

It would not be simple to use Sublime Text in safe mode for days, weeks, or perhaps months to see whether this happens or not, as this bug may take quite some time to happen.

What kind of information can I collect when this problem happens?

I got 281 packages, where: 32 are Dependencies 52 are Default Packages 197 are Third Part Packages

All my packages are forked into my account; there are a few I wrote myself, some packages I rewrote completely, and others I changed small things.

All their code can be found on: https://github.com/evandrocoan/ITE/tree/master/Packages and https://github.com/evandroforks/Packages 1: A File Icon 2: AceJump 3: ActionScript 4: AddFolderToProject 5: AdvancedCSV 6: Alignment 7: AlignTab 8: AllAutocomplete 9: AltUp 10: AmxxChannel 11: AmxxEditor 12: AmxxPawn 13: ANSIescape 14: AppleScript 15: ApplySyntax 16: ASP 17: AutoFileName 18: AutoHotkey 19: AutomaticPackageReloader 20: AutomaticPackageReloader33 21: AutoRefresh 22: AutoWrap 23: backrefs 24: Batch File 25: BBCode 26: BeautifyJavaScript 27: BetterCoffeeScript 28: BetterFindBuffer 29: bracex 30: BracketHighlighter 31: BufferScroll 32: BuildView 33: C# 34: C++ 35: C++ Completions 36: C++ Qt Completions 37: C++ Snippets 38: CaseConversion 39: ChainOfCommand 40: ChangeQuotes 41: channelmanager 42: ChannelRepositoryTools 43: ClearCursorsCarets 44: ClickableURLs 45: ClipboardScopeCopy 46: Clojure 47: CMake 48: Color Highlighter 49: Color Scheme - Default 50: Color Scheme - Legacy 51: ColorHelper 52: ColorSchemeEditor 53: ColorSchemeUnit 54: ColumnSelect 55: concurrentloghandler 56: ConvertToUTF8 57: CopyWithLineNumbersReloaded 58: coverage 59: CSS 60: CythonSyntax 61: D 62: debugtools 63: Default 64: DefaultSyntax 65: DeleteCurrentFile 66: DictionaryAutoComplete 67: Diff 68: diffmatchpatch 69: DistractionFreeWindow 70: DocBlockr 71: DockerSyntaxHighlight 72: Dotfiles 73: DuplicateSelections 74: EditPreferences 75: Emmet 76: Erlang 77: EvaluateInlinePython 78: EvaluatePrinter 79: EvaluateShell 80: ExpandRegion 81: ExportHtml 82: ExtendedTabSwitcher 83: ExtractText 84: FileDiffs 85: FileHistory 86: FileManager 87: FileRename 88: Find++ 89: FindKeyConflicts 90: FixedToggleFindPanel 91: FixProjectSwitchRestartBug 92: FixSelectionAfterIndent 93: ForceRewriteSublimeSettings 94: FuzzyFileNav 95: FuzzyFilePath 96: GenericConfig 97: Gist 98: Git 99: Git Formats 100: GitGutter 101: GitHubMarkdownSnippets 102: Glue 103: Go 104: GoogleSpellCheck 105: GotoLastEditEnhanced 106: Graphviz 107: Groovy 108: Haskell 109: HexViewer 110: HighlightBuildErrors 111: HighlightWords 112: HighlightWordsOnSelection 113: HorizontalScroll 114: HTML 115: HungryBackspace 116: Incrementor 117: IncrementSelection 118: IndentAndBraces 119: IndentSize 120: InsertNums 121: InvertSelection 122: Java 123: JavaScript 124: Javatar 125: JSCustom 126: JSON 127: jsonschema 128: JumpAlongIndent 129: KeepPastedTextSelected 130: Language - English 131: Language - English and Portuguese 132: LanguageTool 133: LaTeX 134: LaTeXSmartQuotes 135: LaTeXTools 136: LaTeXWordCount 137: LaTeXYZ 138: LESS 139: LineEndingsUnify 140: LinesMultisets 141: Lisp 142: LocalHistory 143: LSP 144: LSP-pylsp 145: lsp_utils 146: Lua 147: Makefile 148: Markdown 149: MarkdownPreview 150: MarkdownToBBCode 151: markupsafe 152: Matlab 153: MatlabCompletions 154: MatlabFilenameAutoComplete 155: Maven 156: MaxPane 157: mdpopups 158: MoveTab 159: MoveText 160: MultiEditUtils 161: MySQLSnippets 162: natsort 163: Notepad++ Color Scheme 164: NSIS 165: NumberKing 166: numpy 167: ObjectBeautifier 168: Objective-C 169: OCaml 170: Octave 171: OpenAutoCompletion 172: Origami 173: OverrideAudit 174: OverrideCommitCompletion 175: OverrideEditSettingsDefaultContents 176: OverrideUnpackedPackages 177: package_setting_context 178: PackageDev 179: PackageResourceViewer 180: PackagesManager 181: PanelManager 182: PaneNavigation 183: Pascal 184: pathlib 185: PathTranslator 186: Perl 187: PHP 188: plantumlconnection 189: PlantUmlDiagrams 190: portalockerfile 191: PostScript 192: PowerCursors 193: PowerShell 194: PrettyJSON 195: ProjectSpecificSyntax 196: pushdownparser 197: PushdownParserSyntax 198: pygments 199: pymdownx 200: pyte 201: Python 202: python-jinja2 203: python-markdown 204: python-pywin32 205: PyV8 206: pywinpty 207: pyyaml 208: QuickSettings 209: R 210: Rails 211: RandomEverything 212: REG 213: regex 214: Regular Expressions 215: ReIndent 216: RememberCommandPaletteInput 217: RemoveNonAsciiChars 218: RestructuredText 219: RichPlainText 220: ruamel-yaml 221: Ruby 222: Rust 223: SassSyntax 224: Scala 225: ScopeAlways 226: ScopeHunter 227: SelectAll 228: SelectAllSpellingErrors 229: SelectUntil 230: SemanticLineWrap 231: ShellScript 232: SideBarEnhancements 233: SideBySideCompare 234: SideBySideSettings 235: SkipCloseForClonedViews 236: SortLinesNumerically 237: SQL 238: SQLExec 239: SQLKeywordUppercase 240: SQLTools 241: StickySearch 242: StudioChannel 243: sublime_lib 244: SublimeLinter 245: SublimeLinter-javac 246: SublimeLinter-pylint 247: SublimeTutorial 248: Swift 249: SyncedSideBar 250: SyncViewScroll 251: SyntaxManager 252: TabsExtra 253: TCL 254: TerminalShortcuts 255: Terminus 256: TestPlier 257: Text 258: Textile 259: TextPastry 260: Theme - Default 261: ToggleSettingsInBatch 262: ToggleWords 263: TOML 264: Trimmer 265: TypeScript 266: UnitTesting 267: VBScript 268: ViewSettingsFreely 269: VimL 270: Vintage 271: wcmatch 272: wcwidth 273: Whitespace 274: WordingStatus 275: WrapPlus 276: X86Assembly 277: XML 278: YAML 279: yaml_macros_engine 280: zzz A File Icon zzz 281: ZzzReloadDefaultPackage


evandrocoan commented 8 months ago

The example in the original post needs to show the problem correctly, as it may look like a package doing nasty things. Tomorrow, I will record a new video showing the problem. From the video, you will know there is no way a package could do such a thing.

keith-hall commented 7 months ago

What's your find_selected_text preference set to, out of curiosity?

evandrocoan commented 7 months ago

I have it set to "find_selected_text": true,

I plan to use this to clear the callbacks next time this happens. I hope this is enough.

>>> import sublime_plugin
# before cleaning it up
>>> [(name, functions) for name, functions in sublime_plugin.all_callbacks.items()]
[('on_init', [<LSP.plugin.core.panels.WindowPanelListener object at 0x0000020A283B5CD0>]), ('on_new', []), ('on_clone', []), ('on_load', [<LSP.boot.Listener object at 0x0000020A283B5B20>, <Default.exec.ExecEventListener object at 0x0000020A26161130>]), ('on_revert', []), ('on_reload', []), ('on_pre_close', [<ANSIescape.ansi.AnsiEventListener object at 0x0000020A27CEB0D0>, <HighlightWords.HighlightWords.HighlightWordsGarbageCollector object at 0x0000020A27D03610>, <LSP.boot.Listener object at 0x0000020A283B5B20>, <Default.history_list.JumpHistoryUpdater object at 0x0000020A26153700>]), ('on_close', []), ('on_pre_save', []), ('on_post_save', [<AutomaticPackageReloader.package_reloader.PackageReloaderListener object at 0x0000020A27CEBE80>]), ('on_pre_move', []), ('on_post_move', []), ('on_modified', [<HighlightWords.HighlightWords.HighlightKeywordsCommand object at 0x0000020A27CEBEE0>]), ('on_selection_modified', [<Default.history_list.JumpHistoryUpdater object at 0x0000020A26153700>, <AmxxEditor.AmxxEditor.AmxxEditor object at 0x0000020A269B5C40>]), ('on_activated', [<HighlightWords.HighlightWords.HighlightKeywordsCommand object at 0x0000020A27CEBEE0>, <RememberCommandPaletteInput.input_history.FixedCommandPaletteLastInputHistoryEventListener object at 0x0000020A2843AF10>, <Default.history_list.JumpHistoryUpdater object at 0x0000020A26153700>]), ('on_deactivated', [<Default.history_list.JumpHistoryUpdater object at 0x0000020A26153700>]), ('on_query_context', [<RememberCommandPaletteInput.input_history.FixedCommandPaletteLastInputHistoryEventListener object at 0x0000020A2843AF10>, <Default.block.BlockContext object at 0x0000020A26153520>]), ('on_query_completions', [<CSS.css_completions.CSSCompletions object at 0x0000020A269B5820>, <HTML.html_completions.HtmlTagCompletions object at 0x0000020A269EFD30>, <AmxxEditor.AmxxEditor.AmxxEditor object at 0x0000020A269B5C40>]), ('on_hover', [<Default.symbol.ShowDefinitions object at 0x0000020A269E88B0>, <AmxxEditor.AmxxEditor.AmxxEditor object at 0x0000020A269B5C40>]), ('on_text_command', [<RememberCommandPaletteInput.input_history.FixedCommandPaletteLastInputHistoryEventListener object at 0x0000020A2843AF10>, <Default.exec.FullRegexListener object at 0x0000020A28538700>]), ('on_window_command', [<LSP.plugin.core.panels.WindowPanelListener object at 0x0000020A283B5CD0>, <RememberCommandPaletteInput.input_history.FixedCommandPaletteLastInputHistoryEventListener object at 0x0000020A2843AF10>, <AmxxEditor.AmxxEditor.AmxxEditor object at 0x0000020A269B5C40>]), ('on_post_text_command', [<Default.paste_from_history.ClipboardHistoryUpdater object at 0x0000020A26975B80>]), ('on_post_window_command', [<LSP.boot.Listener object at 0x0000020A283B5B20>]), ('on_modified_async', [<Default.set_unsaved_view_name.SetUnsavedViewName object at 0x0000020A285AAEB0>, <AmxxEditor.AmxxEditor.AmxxEditor object at 0x0000020A269B5C40>]), ('on_selection_modified_async', []), ('on_pre_save_async', []), ('on_post_save_async', [<AmxxEditor.AmxxEditor.AmxxEditor object at 0x0000020A269B5C40>]), ('on_post_move_async', [<LSP.boot.Listener object at 0x0000020A283B5B20>]), ('on_activated_async', [<AmxxEditor.AmxxEditor.AmxxEditor object at 0x0000020A269B5C40>]), ('on_deactivated_async', [<Default.save_on_focus_lost.SaveOnFocusLost object at 0x0000020A285A4F70>]), ('on_new_async', [<ANSIescape.ansi.AnsiEventListener object at 0x0000020A27CEB0D0>]), ('on_load_async', [<ANSIescape.ansi.AnsiEventListener object at 0x0000020A27CEB0D0>, <AmxxEditor.AmxxEditor.AmxxEditor object at 0x0000020A269B5C40>]), ('on_revert_async', []), ('on_reload_async', []), ('on_clone_async', []), ('on_new_buffer', []), ('on_new_buffer_async', []), ('on_associate_buffer', []), ('on_associate_buffer_async', []), ('on_close_buffer', []), ('on_close_buffer_async', []), ('on_new_project', []), ('on_new_project_async', []), ('on_load_project', []), ('on_load_project_async', [<LSP.boot.Listener object at 0x0000020A283B5B20>]), ('on_pre_save_project', []), ('on_post_save_project', []), ('on_post_save_project_async', [<LSP.boot.Listener object at 0x0000020A283B5B20>]), ('on_pre_close_project', []), ('on_new_window', [<LSP.plugin.core.panels.WindowPanelListener object at 0x0000020A283B5CD0>]), ('on_new_window_async', [<LSP.boot.Listener object at 0x0000020A283B5B20>]), ('on_pre_close_window', [<LSP.boot.Listener object at 0x0000020A283B5B20>, <LSP.plugin.core.panels.WindowPanelListener object at 0x0000020A283B5CD0>]), ('on_exit', [<LSP.boot.Listener object at 0x0000020A283B5B20>])]
# cleaning
>>> [(name, functions.clear()) for name, functions in sublime_plugin.all_callbacks.items()]
[('on_init', None), ('on_new', None), ('on_clone', None), ('on_load', None), ('on_revert', None), ('on_reload', None), ('on_pre_close', None), ('on_close', None), ('on_pre_save', None), ('on_post_save', None), ('on_pre_move', None), ('on_post_move', None), ('on_modified', None), ('on_selection_modified', None), ('on_activated', None), ('on_deactivated', None), ('on_query_context', None), ('on_query_completions', None), ('on_hover', None), ('on_text_command', None), ('on_window_command', None), ('on_post_text_command', None), ('on_post_window_command', None), ('on_modified_async', None), ('on_selection_modified_async', None), ('on_pre_save_async', None), ('on_post_save_async', None), ('on_post_move_async', None), ('on_activated_async', None), ('on_deactivated_async', None), ('on_new_async', None), ('on_load_async', None), ('on_revert_async', None), ('on_reload_async', None), ('on_clone_async', None), ('on_new_buffer', None), ('on_new_buffer_async', None), ('on_associate_buffer', None), ('on_associate_buffer_async', None), ('on_close_buffer', None), ('on_close_buffer_async', None), ('on_new_project', None), ('on_new_project_async', None), ('on_load_project', None), ('on_load_project_async', None), ('on_pre_save_project', None), ('on_post_save_project', None), ('on_post_save_project_async', None), ('on_pre_close_project', None), ('on_new_window', None), ('on_new_window_async', None), ('on_pre_close_window', None), ('on_exit', None)]
# after
>>> [(name, functions) for name, functions in sublime_plugin.all_callbacks.items()]
[('on_init', []), ('on_new', []), ('on_clone', []), ('on_load', []), ('on_revert', []), ('on_reload', []), ('on_pre_close', []), ('on_close', []), ('on_pre_save', []), ('on_post_save', []), ('on_pre_move', []), ('on_post_move', []), ('on_modified', []), ('on_selection_modified', []), ('on_activated', []), ('on_deactivated', []), ('on_query_context', []), ('on_query_completions', []), ('on_hover', []), ('on_text_command', []), ('on_window_command', []), ('on_post_text_command', []), ('on_post_window_command', []), ('on_modified_async', []), ('on_selection_modified_async', []), ('on_pre_save_async', []), ('on_post_save_async', []), ('on_post_move_async', []), ('on_activated_async', []), ('on_deactivated_async', []), ('on_new_async', []), ('on_load_async', []), ('on_revert_async', []), ('on_reload_async', []), ('on_clone_async', []), ('on_new_buffer', []), ('on_new_buffer_async', []), ('on_associate_buffer', []), ('on_associate_buffer_async', []), ('on_close_buffer', []), ('on_close_buffer_async', []), ('on_new_project', []), ('on_new_project_async', []), ('on_load_project', []), ('on_load_project_async', []), ('on_pre_save_project', []), ('on_post_save_project', []), ('on_post_save_project_async', []), ('on_pre_close_project', []), ('on_new_window', []), ('on_new_window_async', []), ('on_pre_close_window', []), ('on_exit', [])]
saagarjha commented 7 months ago

I'm seeing this too, on macOS. Since the text seems to be populated using the find pasteboard, I've been able to work around it by searching for stuff in other apps a couple times and it will usually start working again. Maybe I could debug the app and see where it is doing this when it occurs?

valeriesubl commented 7 months ago

Thanks, we have a potential fix in the works.

I've been able to reproduce this on macOS when regex search is enabled and the initial text in the search field is from the macOS global Find pasteboard (e.g. ⌘F in Safari).

@evandrocoan when the issue occurs for you on Linux or Windows, is it under similar conditions to the above?

jpmckinney commented 7 months ago

Those match my conditions on macOS.

evandrocoan commented 7 months ago

When you encounter this issue on Linux or Windows, does it occur under similar conditions to those previously mentioned?

I believe my issue is different or it at least manifests differently on Mac OS. I'm not sure how to reproduce it, but when it happens, restarting Sublime Text is the only solution that works. The problem seems to be isolated to a specific window, as other windows remain unaffected. I haven't tried restarting just the problematic window yet, but I will test that the next time the issue occurs.

I recorded a video of the issue recently and thought I had posted it here. I'm hoping it's still in my work's trash bin. On Monday, I'll attempt to retrieve it and update the original post.

evandrocoan commented 7 months ago

I've been able to work around it by searching for stuff in other apps a couple times and it will usually start working again.

@saagarjha, when you experience this issue, does it impact all of your open Sublime Text windows, or is it confined to just one specific window?

evandrocoan commented 7 months ago

His is the demonstration of the issue I recorded last week on Linux. I got another Sublime Text window on top to show the console key events: Peek2023-11-13 18-20-searchbug

saagarjha commented 6 months ago

This is a problem in all my windows. (Sorry for the delayed response, this is just when I saw it reproduce and was able to check this.)

JulyIghor commented 6 months ago

It appears to be reproduced only with a copy pasted text to the search field. Once I edit the field by typing something, it become work as normal

UserNotFound commented 6 months ago

It appears to be reproduced only with a copy pasted text to the search field. Once I edit the field by typing something, it become work as normal

This is exactly what I'm seeing as well.

duxing commented 5 months ago

came from #6209 : I'm experiencing the same since that upgrade. it affects all the sublime windows and tabs and it really kills productivity.

it's been 2months since this issue was opened: any chance we can get more attention to this issue? maybe start looking into the release notes of that particular version?

BenjaminSchaaf commented 5 months ago

We've got a fix in the works. In the mean time turning off the "regex_auto_escape" setting should be a workaround. Otherwise you can downgrading to a previous version.

JulyIghor commented 5 months ago

you can downgrading to

Which version exactly has no issue like that?

BenjaminSchaaf commented 5 months ago

Which version exactly has no issue like that?

The previous stable build 4166.

silverwind commented 5 months ago

Not sure if it's the same issue, but I noticed this problem in build 4169 or earlier on Mac:

Disabling regex_auto_escape fixes the issue for me, even though I haven't toggled regex on.

BenjaminSchaaf commented 4 months ago

Fixed in build 4170.

silverwind commented 4 months ago

Fixed in build 4170.

Thanks. It looks like that fix also resolved https://github.com/sublimehq/sublime_text/issues/6194#issuecomment-1935787298 for me.

arttuperala commented 3 months ago

Still happening to me in build 4173, although less frequently and I don't know how to consistently replicate it. Just had it happen in a file where it showed a string in the search box after pressing Cmd+F, I'd paste some text in the search box with Cmd+V and the text would get reverted back to what it was when I hit Cmd+F as soon as I hit Enter. Exactly how it was broken before I upgraded to the dev branch. Restarting Sublime Text helps. macOS 14.4.1 (23E224), M2 Max.

jpmckinney commented 2 months ago

Noting that I’ve also seen this behavior (more rarely than before, not clear how to replicate). Since I know it’s related to clipboards and search strings, I typically play with those to get back to desired behavior.

JulyIghor commented 2 months ago

I confirm it is still here 4175