fix tab behavior, should not print

This commit is contained in:
Mitchell Hashimoto
2022-07-14 13:43:38 -07:00
parent d242c64013
commit 3655609886
3 changed files with 24 additions and 2 deletions

View File

@ -19,3 +19,4 @@ Status meanings:
| `ENQ` | `0x05` | [Enquiry](sequences/enq.md) | ✅ |
| `BEL` | `0x07` | [Bell](sequences/bel.md) | ❌ |
| `BS` | `0x08` | [Backspace](sequences/bs.md) | ⚠️ |
| `TAB` | `0x09` | [Tab](sequences/tab.md) | ⚠️ |

21
docs/sequences/tab.md Normal file
View File

@ -0,0 +1,21 @@
# Tab
| | |
| --- | --- |
| Text | |
| Hex | `0x09` |
Move the cursor right to the next tab stop.
A tab stop is a specifically marked column that a cursor stops when a tab
is invoked. Tab stops are typically thought of as uniform spacing (i.e.
four spaces) but in terminals this is not the case: tab stops can be set
at any column number using the [tab set](#) and [tab clear](#)
sequences.
Initially, tab stops are set on every 8th column.
## TODO
* Integration with left/right margins of the scrolling region.
* How does horizontal tab interact with the pending wrap state?

View File

@ -543,8 +543,8 @@ pub fn horizontalTab(self: *Terminal) !void {
defer tracy.end();
while (self.cursor.x < self.cols) {
// Clear
try self.print(' ');
// Move the cursor right
self.cursor.x += 1;
// If the last cursor position was a tabstop we return. We do
// "last cursor position" because we want a space to be written