Skip to content

[BUG] TUI Panic Leaves Terminal in Raw Mode #104

@olddev94

Description

@olddev94

Project

vgrep

Description

The interactive TUI in src/ui/search_tui.rs does not properly handle panics. If any code between enable_raw_mode() and disable_raw_mode() panics, the terminal will be left in raw mode, making it unusable until the user runs reset or opens a new terminal.

Error Message

After panic, terminal shows:
- No echo of typed characters
- No line editing
- Ctrl+C doesn't work properly
- Prompts not displayed correctly

Debug Logs

System Information

- Bounty Version: 0.1.0
- OS: Ubuntu 24.04 LTS
- Rust: 1.75+

Screenshots

No response

Steps to Reproduce

  1. Start interactive TUI: vgrep tui
  2. Trigger a panic (e.g., by corrupting database or causing memory issue)
  3. Observe terminal is left in broken state
  4. Must run reset or stty sane to fix

Expected Behavior

Terminal should be restored to normal state even if the TUI code panics:

  1. Raw mode disabled
  2. Alternate screen exited
  3. Mouse capture disabled
  4. Cursor shown

Actual Behavior

If panic occurs:

  1. Terminal left in raw mode
  2. Alternate screen may still be active
  3. User input is garbled
  4. User must manually run reset command

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingideIssues related to IDEinvalidThis doesn't seem rightvgrep

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions