From 534de78d378a75846abd1e14346dea7b011e6505 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 5 Dec 2023 09:43:53 -0800 Subject: [PATCH] core: alternate scroll encoding should respect DECCKM --- src/Surface.zig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Surface.zig b/src/Surface.zig index f2d903a27..50de3b1c2 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -1474,7 +1474,13 @@ pub fn scrollCallback( // clear the selection. self.setSelection(null); - const seq = if (y.delta < 0) "\x1bOA" else "\x1bOB"; + const seq = if (self.io.terminal.modes.get(.cursor_keys)) seq: { + // cursor key: application mode + break :seq if (y.delta < 0) "\x1bOA" else "\x1bOB"; + } else seq: { + // cursor key: normal mode + break :seq if (y.delta < 0) "\x1b[A" else "\x1b[B"; + }; for (0..y.delta_unsigned) |_| { _ = self.io_thread.mailbox.push(.{ .write_stable = seq,