Skip to content

[Bug]: Ctrl+S while editing a filter saves the old value and reports success #40

Description

@fedonman

Bug Description

While a sidebar text field is being edited, every key is routed to on_sidebar_key, which matches Ctrl+S before handing anything to the filter tree. The edit buffer is only committed into params on Enter, so Ctrl+S mid-edit serialises the previous params, without the text just typed, and then flashes Filter settings saved. The statusbar advertises Ctrl+S Save the whole time the sidebar has focus, editing included, so the misleading path is the one the UI points at.

Steps to Reproduce

Focus the filter sidebar, start editing the user field, type a username, and press Ctrl+S because the hint bar says Save.

Expected Behavior

Either the value just typed gets saved, or the shortcut declines while editing. Not a success message over a stale write.

Actual Behavior

typed 'alice'; params.user that would be saved = Some("olduser")
after Enter, params.user = Some("alice")

The old value goes to disk, the flash says it saved, and the next launch restores the old filter, so the user concludes persistence is flaky.

System Information

sqwatch 0.2.0, source checkout at 4c594fb
Ubuntu 26.04.1, rustc 1.97.1

Guarding the shortcut on !self.filter_tree.is_editing() fixes the wrong report, but committing first and then saving is barely larger and does what the user meant, since Ctrl+S mid-edit almost certainly means keep what I just typed. That needs a commit_edit(&mut params) on FilterTree lifted out of the existing Enter arm, which is a move rather than new logic.

The same missing check means a literal s cannot be typed into a pattern while Control is held, which is harmless for a regex but is the same bug. While in the statusbar code, the hint should read Enter Apply during an edit rather than Enter Edit/Toggle, since Enter is the key that actually commits.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdashboardTouches the dashboard: app state, refresh cycle, key routing, layout

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions