xterm audit: DECOM (origin mode)

This commit is contained in:
Mitchell Hashimoto
2023-11-21 18:32:00 -08:00
parent de25ba231e
commit 34cfe0abab
3 changed files with 81 additions and 1 deletions

View File

@@ -2170,6 +2170,20 @@ test "Terminal: fullReset with a non-empty pen" {
try testing.expect(cell.fg.eql(.{}));
}
test "Terminal: fullReset origin mode" {
var t = try init(testing.allocator, 10, 10);
defer t.deinit(testing.allocator);
t.setCursorPos(3, 5);
t.modes.set(.origin, true);
t.fullReset(testing.allocator);
// Origin mode should be reset and the cursor should be moved
try testing.expectEqual(@as(usize, 0), t.screen.cursor.y);
try testing.expectEqual(@as(usize, 0), t.screen.cursor.x);
try testing.expect(!t.modes.get(.origin));
}
test "Terminal: input with no control characters" {
var t = try init(testing.allocator, 80, 80);
defer t.deinit(testing.allocator);

View File

@@ -1749,7 +1749,9 @@ const StreamHandler = struct {
// Schedule a render since we changed colors
.reverse_colors => try self.queueRender(),
// Origin resets cursor pos
// Origin resets cursor pos. This is called whether or not
// we're enabling or disabling origin mode and whether or
// not the value changed.
.origin => self.terminal.setCursorPos(1, 1),
.enable_left_and_right_margin => if (!enabled) {