Skip to content

fix: suspend hover focus during tab rename#97

Open
Munawwar wants to merge 2 commits into
am-will:mainfrom
Munawwar:fix/rename-hover-focus-guard
Open

fix: suspend hover focus during tab rename#97
Munawwar wants to merge 2 commits into
am-will:mainfrom
Munawwar:fix/rename-hover-focus-guard

Conversation

@Munawwar

@Munawwar Munawwar commented Jun 3, 2026

Copy link
Copy Markdown

Hi. First off, nice project. I like it and I use this everyday now.

I noticed that when "Hover terminal focus" toggle is enabled I could not rename tabs without accidentally focusing on terminal. So I couldn't type inside the tab rename text field (which is bug 1), nor could I focus back at it (which is bug 2). This change attempts to fix both.

Bug 1

The way I implemented is to try a skip the hover focus code path by checking if any tab (one or more .. so had to use a counter ¹) is in "rename" state. I don't know if this was the cleanest fix, and I know zero rust (did c++ before but not rust), and codex did helped me through.

¹ after my fix of bug 2 it can only be 1 tab in rename state at a time .. so this was a bit too defensive .. but changing it from counter to boolean doesn't reduce LoC either, so 🤷‍♂️ going to keep it the way it is

Bug 2

On checking code for this bug, I realized the code was meant to exit rename state on focus exit. But it remained in a partial exited state as you can see in this video:
https://github.com/user-attachments/assets/80348bf2-113c-4b76-ac53-8a21c512ef89

My understanding is that one cant just mutate tab state within connect_leave event as GTK focus transitioning hasn't fully finished yet, and that's why this bug happens. You have to wait a bit. So my idea is 1. dont even rely on that event, rather watch for has-focus becoming false as that feels more stable state and 2. then add a GTK idle state callback to exit from the "rename" state.

@am-will

am-will commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Thanks for chasing the hover-focus side of tab rename. I pushed a combined fix to main in f679daf that incorporates the key ideas from this PR: hover-terminal-focus is suppressed while a tab rename editor is active, and blur cleanup is deferred to an idle callback so GTK focus transitions can settle.

The final implementation also adds the missing canonical lifecycle pieces from #109: only one active rename editor per pane, repeated rename refocuses/reuses instead of stacking, and tab activation/drag are suppressed while editing.

Validation: ./scripts/check.sh passes. Please test the next update in your normal setup if you can.

@bvolpato bvolpato left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Core approach looks good: RAII hover suppression and deferred blur cleanup address GTK focus timing cleanly.

nonblocking: this PR is superseded by f679daf on main. Current implementation includes these fixes plus single-editor lifecycle and tab interaction guards. This head is 26 commits behind and conflicts in both changed files, so it should close without merge.

(Review assisted by gpt-5.6-sol)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants