mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
terminal: RIS should reset tabstops, ESC ? W should reset every 8
Fixes #648 Two issues here: - RIS should've been resetting the tabstops to every 8, but was clearing all tabstops. - `ESC ? W` should've reset tabstops to every 8, but was clearing all tabstops.
This commit is contained in:
@ -1487,6 +1487,11 @@ pub fn tabSet(self: *Terminal) void {
|
|||||||
self.tabstops.set(self.screen.cursor.x);
|
self.tabstops.set(self.screen.cursor.x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// TODO: test
|
||||||
|
pub fn tabReset(self: *Terminal) void {
|
||||||
|
self.tabstops.reset(TABSTOP_INTERVAL);
|
||||||
|
}
|
||||||
|
|
||||||
/// Carriage return moves the cursor to the first column.
|
/// Carriage return moves the cursor to the first column.
|
||||||
pub fn carriageReturn(self: *Terminal) void {
|
pub fn carriageReturn(self: *Terminal) void {
|
||||||
const tracy = trace(@src());
|
const tracy = trace(@src());
|
||||||
@ -1922,7 +1927,7 @@ pub fn fullReset(self: *Terminal, alloc: Allocator) void {
|
|||||||
self.screen.charset = .{};
|
self.screen.charset = .{};
|
||||||
self.modes = .{};
|
self.modes = .{};
|
||||||
self.flags = .{};
|
self.flags = .{};
|
||||||
self.tabstops.reset(0);
|
self.tabstops.reset(TABSTOP_INTERVAL);
|
||||||
self.screen.cursor = .{};
|
self.screen.cursor = .{};
|
||||||
self.screen.saved_cursor = .{};
|
self.screen.saved_cursor = .{};
|
||||||
self.screen.selection = null;
|
self.screen.selection = null;
|
||||||
|
@ -169,9 +169,11 @@ const ModeEntry = struct {
|
|||||||
/// they're used within Ghostty or google their values. It is not
|
/// they're used within Ghostty or google their values. It is not
|
||||||
/// valuable to redocument them all here.
|
/// valuable to redocument them all here.
|
||||||
const entries: []const ModeEntry = &.{
|
const entries: []const ModeEntry = &.{
|
||||||
|
// ANSI
|
||||||
.{ .name = "insert", .value = 4, .ansi = true },
|
.{ .name = "insert", .value = 4, .ansi = true },
|
||||||
|
|
||||||
.{ .name = "cursor_keys", .value = 1 },
|
// DEC
|
||||||
|
.{ .name = "cursor_keys", .value = 1 }, // DECCKM
|
||||||
.{ .name = "132_column", .value = 3 },
|
.{ .name = "132_column", .value = 3 },
|
||||||
.{ .name = "reverse_colors", .value = 5 },
|
.{ .name = "reverse_colors", .value = 5 },
|
||||||
.{ .name = "origin", .value = 6 },
|
.{ .name = "origin", .value = 6 },
|
||||||
|
@ -376,10 +376,10 @@ pub fn Stream(comptime Handler: type) type {
|
|||||||
'W' => {
|
'W' => {
|
||||||
switch (action.params.len) {
|
switch (action.params.len) {
|
||||||
0 => if (action.intermediates.len == 1 and action.intermediates[0] == '?') {
|
0 => if (action.intermediates.len == 1 and action.intermediates[0] == '?') {
|
||||||
if (@hasDecl(T, "tabClear"))
|
if (@hasDecl(T, "tabReset"))
|
||||||
try self.handler.tabClear(.all)
|
try self.handler.tabReset()
|
||||||
else
|
else
|
||||||
log.warn("unimplemented tab clear callback: {}", .{action});
|
log.warn("unimplemented tab reset callback: {}", .{action});
|
||||||
},
|
},
|
||||||
|
|
||||||
1 => switch (action.params[0]) {
|
1 => switch (action.params[0]) {
|
||||||
|
@ -1653,6 +1653,10 @@ const StreamHandler = struct {
|
|||||||
self.terminal.tabSet();
|
self.terminal.tabSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn tabReset(self: *StreamHandler) !void {
|
||||||
|
self.terminal.tabReset();
|
||||||
|
}
|
||||||
|
|
||||||
pub fn saveCursor(self: *StreamHandler) !void {
|
pub fn saveCursor(self: *StreamHandler) !void {
|
||||||
self.terminal.saveCursor();
|
self.terminal.saveCursor();
|
||||||
}
|
}
|
||||||
|
@ -28,85 +28,3 @@ The full reset operation does the following:
|
|||||||
- Move the cursor to the top-left corner
|
- Move the cursor to the top-left corner
|
||||||
- Reset the pending wrap state
|
- Reset the pending wrap state
|
||||||
- Reset saved cursor state
|
- Reset saved cursor state
|
||||||
|
|
||||||
## Validation
|
|
||||||
|
|
||||||
### DECSLRM V-1: Full Screen
|
|
||||||
|
|
||||||
```bash
|
|
||||||
printf "\033[1;1H" # move to top-left
|
|
||||||
printf "\033[0J" # clear screen
|
|
||||||
printf "ABC\n"
|
|
||||||
printf "DEF\n"
|
|
||||||
printf "GHI\n"
|
|
||||||
printf "\033[?69h" # enable left/right margins
|
|
||||||
printf "\033[s" # scroll region left/right
|
|
||||||
printf "\033[X"
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
|cBC_____|
|
|
||||||
|DEF_____|
|
|
||||||
|GHI_____|
|
|
||||||
```
|
|
||||||
|
|
||||||
### DECSLRM V-2: Left Only
|
|
||||||
|
|
||||||
```bash
|
|
||||||
printf "\033[1;1H" # move to top-left
|
|
||||||
printf "\033[0J" # clear screen
|
|
||||||
printf "ABC\n"
|
|
||||||
printf "DEF\n"
|
|
||||||
printf "GHI\n"
|
|
||||||
printf "\033[?69h" # enable left/right margins
|
|
||||||
printf "\033[2s" # scroll region left/right
|
|
||||||
printf "\033[2G" # move cursor to column 2
|
|
||||||
printf "\033[L"
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
|Ac______|
|
|
||||||
|DBC_____|
|
|
||||||
|GEF_____|
|
|
||||||
| HI_____|
|
|
||||||
```
|
|
||||||
|
|
||||||
### DECSLRM V-3: Left And Right
|
|
||||||
|
|
||||||
```bash
|
|
||||||
printf "\033[1;1H" # move to top-left
|
|
||||||
printf "\033[0J" # clear screen
|
|
||||||
printf "ABC\n"
|
|
||||||
printf "DEF\n"
|
|
||||||
printf "GHI\n"
|
|
||||||
printf "\033[?69h" # enable left/right margins
|
|
||||||
printf "\033[1;2s" # scroll region left/right
|
|
||||||
printf "\033[2G" # move cursor to column 2
|
|
||||||
printf "\033[L"
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
|_cC_____|
|
|
||||||
|ABF_____|
|
|
||||||
|DEI_____|
|
|
||||||
|GH______|
|
|
||||||
```
|
|
||||||
|
|
||||||
### DECSLRM V-4: Left Equal to Right
|
|
||||||
|
|
||||||
```bash
|
|
||||||
printf "\033[1;1H" # move to top-left
|
|
||||||
printf "\033[0J" # clear screen
|
|
||||||
printf "ABC\n"
|
|
||||||
printf "DEF\n"
|
|
||||||
printf "GHI\n"
|
|
||||||
printf "\033[?69h" # enable left/right margins
|
|
||||||
printf "\033[2;2s" # scroll region left/right
|
|
||||||
printf "\033[X"
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
|cBC_____|
|
|
||||||
|DEF_____|
|
|
||||||
|GHI_____|
|
|
||||||
```
|
|
||||||
|
Reference in New Issue
Block a user