Skip to content

API turboframe.ui.searching

rafageist edited this page Dec 4, 2026 · 5 revisions

turboframe.ui.searching

Source: turboframe/ui/searching.py. Generated from the code of TurboFrame 0.3.0 by tools/wiki_api.py.

Search > Find, Replace and Search again, in the text of the editor being edited.

SearchMixin is part of the application (a DesktopApp):

  • Find (CM_FIND) opens the Find dialog (turboframe.ui.dialogs.SearchDialog) with the selection, or the word under the cursor, or the last text; OK selects the next match (the previous one, backward), from the cursor or from the scope's edge (Entire scope), wrapping around the text's end (the status says so).
  • Replace (CM_REPLACE) replaces the next match; Change all every one, as one edit that a single Undo restores, or one at a time asking (Prompt on replace: Yes, No, All, Cancel; replace_prompt).
  • Search again (CM_SEARCH_AGAIN) repeats the last Find or Replace from the cursor (the dialog when nothing was searched yet).

The text and the options are kept in search_text and search_options, the attributes turboframe.ui.findfiles.FindInFilesMixin keeps, so both share them; the replacement in search_replacement. The search itself is turboframe.search. search_target() is the hook that says which editor window is searched (the active editor); search_command(command) runs the three commands for the application's run_command.

Contents

CM_FIND, CM_REPLACE, CM_SEARCH_AGAIN, SEARCH_COMMANDS, initial_query, SearchMixin

CM_FIND

10295

CM_REPLACE

10296

CM_SEARCH_AGAIN

10297

SEARCH_COMMANDS

frozenset({10295, 10296, 10297})

initial_query

def initial_query(editor, last: str) -> str

What the Find dialog starts with: the selection when it is on one line, else the word under the cursor, else last.

class SearchMixin

class SearchMixin

Find, Replace and Search again over an editor window's editor (a TextArea), mixed into a DesktopApp: await self.find() (replace(), search_again()) from a worker.

  • search_target(): The editor window searched: the application's active_editor() when it has one, else the active window when it has an editor.
  • async find(window=None) -> None: Search > Find.
  • async replace(window=None) -> None: Search > Replace.
  • async search_again(window=None) -> None: Search > Search again: the last Find or Replace from the cursor (the Find dialog before any).
  • async search_command(command: int) -> bool: Run one of SEARCH_COMMANDS (from a worker); False for another command.
  • async search_dialog(window, *, replace: bool) -> None
  • async search(window, *, first: bool, change_all: bool = False) -> None: Run the stored find or replace from the cursor (or the scope's edge on the first run).

Clone this wiki locally