diff options
Diffstat (limited to 'core/keys.zig')
| -rw-r--r-- | core/keys.zig | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/core/keys.zig b/core/keys.zig index 8bfe8315..91cb2724 100644 --- a/core/keys.zig +++ b/core/keys.zig @@ -58,8 +58,7 @@ pub fn enterTty(p: *Pardes, id: usize) void { const pane = p.panes[id] orelse return; const selected = pane.rawPointerText(pane.sel[@backingInt(config.select_button)]) != null; if (!selected and pane.body.cur_pinned) if (pane.terminal) |state| { - const row = pane.gridRow(pane.body.cur_row) - @as(i32, @intCast(panes.Term.grid(state).offset)); - if (panes.Term.promptMoves(state, row, pane.body.cur_col)) |moves| { + if (panes.Term.promptMoves(state, pane.gridRow(pane.body.cur_row), pane.body.cur_col)) |moves| { for (0..moves.left) |_| p.emitWrite(id, "\x1b[D"); for (0..moves.right) |_| p.emitWrite(id, "\x1b[C"); } @@ -546,7 +545,7 @@ test "Esc back into a tty leaves its view at the prompt" { p.update(.{ .output = .{ .pane = .at(shell), .bytes = std.fmt.bufPrint(&buf, "line {d}\r\n", .{i}) catch unreachable } }); } p.sync(); - const live = pardes.Term.grid(sp.terminal).offset; + const live = sp.termTop(); try std.testing.expect(live > 0); p.update(.{ .key = .{ .cp = Key.escape } }); // shell-prompt heuristic: out to the doc @@ -555,7 +554,7 @@ test "Esc back into a tty leaves its view at the prompt" { p.sync(); try std.testing.expectEqual(shell, p.view().active); - try std.testing.expectEqual(live, pardes.Term.grid(sp.terminal).offset); + try std.testing.expectEqual(live, sp.termTop()); } test "Del from a key asks which neighbour takes the rows; nothing else asks" { @@ -805,7 +804,7 @@ test "raw tty forwards Ctrl letters and former global shortcuts to the child" { } p.update(.{ .key = .{ .cp = Key.up } }); try std.testing.expectEqualStrings("\x1b[A", test_api.ptyBytes(p, null, &buf)); - _ = pardes.Term.feed(p.panes[0].?.terminal.?, "\x1b[?1h", &.{}, &.{}, &.{}); // DECCKM + _ = pardes.Term.feed(p.panes[0].?.terminal.?, "\x1b[?1h", &.{}, &.{}, &.{}, &.{}); // DECCKM p.update(.{ .key = .{ .cp = Key.up } }); try std.testing.expectEqualStrings("\x1bOA", test_api.ptyBytes(p, null, &buf)); p.update(.{ .key = .{ .cp = Key.left, .ctrl = true } }); |
