mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
xterm audit: DECOM (origin mode)
This commit is contained in:
@ -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);
|
||||
|
@ -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) {
|
||||
|
64
website/app/vt/modes/decom/page.mdx
Normal file
64
website/app/vt/modes/decom/page.mdx
Normal file
@ -0,0 +1,64 @@
|
||||
import VTMode from "@/components/VTMode";
|
||||
|
||||
# Origin (DECOM)
|
||||
|
||||
<VTMode value={6} />
|
||||
|
||||
Changes the origin of grid coordinates to be relative to the current scroll
|
||||
region.
|
||||
|
||||
When set or unset, this invokes [Cursor Position (CUP)](/vt/cup) with row 1 and
|
||||
column 1. If origin mode is set, this will position the cursor to the
|
||||
top-left location of the current scroll region. If origin mode is not set,
|
||||
this will position the cursor to the top-left location of the screen. The
|
||||
cursor position will be set even if the origin mode is _unchanged_.
|
||||
|
||||
The following commands are affected by origin mode. Please see their
|
||||
respective documentation for details on how origin mode impacts their
|
||||
behavior.
|
||||
|
||||
- [Carriage Return (CR)](/vt/cr)
|
||||
- [Cursor Position Set (CUP)](/vt/cup)
|
||||
- [Cursor Position Report (CPR)](/vt/cpr)
|
||||
- [Save Cursor (DECSC)](/vt/decsc)
|
||||
- [Restore Cursor (DECRC)](/vt/decrc)
|
||||
- [Horizontal Position Absolute (HPA)](/vt/hpa)
|
||||
- [Vertical Position Absolute (VPA)](/vt/vpa)
|
||||
- [Horizontal Position Relative (HPR)](/vt/hpr)
|
||||
- [Vertical Position Relative (VPR)](/vt/vpr)
|
||||
- [Cursor Backward Tabulation (CBT)](/vt/cbt)
|
||||
- [Screen Alignment Test (DECALN)](/vt/decaln)
|
||||
- [Full Reset (RIS)](/vt/ris)
|
||||
- [Soft Reset (DECSTR)](/vt/decstr)
|
||||
|
||||
## Validation
|
||||
|
||||
### DECOM V-1: Unset No Margins
|
||||
|
||||
```bash
|
||||
printf "\033[H"
|
||||
printf "\033[2J"
|
||||
printf "ABC\n"
|
||||
printf "\033[?6l"
|
||||
printf "X"
|
||||
```
|
||||
|
||||
```
|
||||
|XBC_____|
|
||||
|________|
|
||||
```
|
||||
|
||||
### DECOM V-1: Set No Margins
|
||||
|
||||
```bash
|
||||
printf "\033[H"
|
||||
printf "\033[2J"
|
||||
printf "ABC\n"
|
||||
printf "\033[?6h"
|
||||
printf "X"
|
||||
```
|
||||
|
||||
```
|
||||
|XBC_____|
|
||||
|________|
|
||||
```
|
Reference in New Issue
Block a user