Skip to content

feat: add search and replace in the code editor #9

Description

@Jatin-Shihora

There's no way to find or replace text in the editor. If you have a long solution and want to rename a variable or find where you used a function, you have to scroll through manually. This gets painful with longer solutions.

What should happen

  • Ctrl+F opens a search bar at the top or bottom of the editor
  • Typing in the search bar highlights all matches in the code and jumps to the first one
  • Enter or arrow keys cycle through matches
  • Ctrl+H opens search + replace mode with a second input field
  • Esc closes the search bar

Things to consider

  • The search bar needs its own input handling separate from the editor. When search is active, typed characters go to the search input, not the code buffer
  • Highlight matches using reverse video or a distinct background color via blessed's formatting
  • Match highlighting needs to work with Pygments syntax highlighting already applied to the code. You'll need to overlay match colors on top of syntax colors
  • Case-insensitive search by default, with an option to toggle case sensitivity
  • The editor currently renders in render() in tui/editor.py. Match highlights would be added during the token rendering loop

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions