Merge pull request #1245 from mitchellh/clear-screen-consume

core: clear_screen binding doesn't consume on alt screen
This commit is contained in:
Mitchell Hashimoto
2024-01-07 08:04:59 -08:00
committed by GitHub

View File

@ -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 = {} });