mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 07:46:12 +03:00
core: clear_screen binding doesn't consume on alt screen
The clear_screen binding does nothing on the alternate screen already, but we were still marking the action as "performed" which caused the binding to be consumed. This meant that alt screen applications like neovim, tmux, etc. couldn't see "cmd+k" (default binding for clear_screen on macOS) without the Ghostty user unbinding it completely. We already have other bindings that do not consume only when they do not perform, such as `previous_tab` and `next_tab`. This extends the framework we built for that to this action.
This commit is contained in:
@ -2788,6 +2788,17 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
|
|||||||
},
|
},
|
||||||
|
|
||||||
.clear_screen => {
|
.clear_screen => {
|
||||||
|
// This is a duplicate of some of the logic in termio.clearScreen
|
||||||
|
// but we need to do this here so we can know the answer before
|
||||||
|
// we send the message. If the currently active screen is on the
|
||||||
|
// alternate screen then clear screen does nothing so we want to
|
||||||
|
// return false so the keybind can be unconsumed.
|
||||||
|
{
|
||||||
|
self.renderer_state.mutex.lock();
|
||||||
|
defer self.renderer_state.mutex.unlock();
|
||||||
|
if (self.io.terminal.active_screen == .alternate) return false;
|
||||||
|
}
|
||||||
|
|
||||||
_ = self.io_thread.mailbox.push(.{
|
_ = self.io_thread.mailbox.push(.{
|
||||||
.clear_screen = .{ .history = true },
|
.clear_screen = .{ .history = true },
|
||||||
}, .{ .forever = {} });
|
}, .{ .forever = {} });
|
||||||
|
Reference in New Issue
Block a user