Implement CBT
This commit is contained in:
parent
93808cf757
commit
9e68cc559a
@ -225,6 +225,8 @@
|
||||
// *Horizontal position adjust*: Same as :data:`CHA`.
|
||||
#define HPA '`'
|
||||
|
||||
// Back tab
|
||||
#define CBT 'Z'
|
||||
|
||||
// Misc sequences
|
||||
// ----------------
|
||||
|
||||
@ -353,6 +353,8 @@ void screen_reverse_index(Screen *self);
|
||||
void screen_index(Screen *self);
|
||||
void screen_reset(Screen *self);
|
||||
void screen_set_tab_stop(Screen *self);
|
||||
void screen_tab(Screen *self);
|
||||
void screen_backtab(Screen *self, unsigned int);
|
||||
void screen_clear_tab_stop(Screen *self, unsigned int how);
|
||||
void screen_set_mode(Screen *self, unsigned int mode);
|
||||
void screen_reset_mode(Screen *self, unsigned int mode);
|
||||
|
||||
@ -410,6 +410,8 @@ dispatch_csi(Screen *screen, PyObject DUMP_UNUSED *dump_callback) {
|
||||
CALL_CSI_HANDLER1(screen_cursor_to_column, 1);
|
||||
case VPA:
|
||||
CALL_CSI_HANDLER1(screen_cursor_to_line, 1);
|
||||
case CBT:
|
||||
CALL_CSI_HANDLER1(screen_backtab, 1);
|
||||
case CUP:
|
||||
case HVP:
|
||||
CALL_CSI_HANDLER2(screen_cursor_position, 1, 1);
|
||||
|
||||
@ -430,6 +430,22 @@ screen_tab(Screen *self) {
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
screen_backtab(Screen *self, unsigned int count) {
|
||||
// Move back count tabs
|
||||
if (!count) count = 1;
|
||||
unsigned int before = self->cursor->x;
|
||||
int i;
|
||||
while (count > 0 && self->cursor->x > 0) {
|
||||
count--;
|
||||
for (i = self->cursor->x - 1; i >= 0; i--) {
|
||||
if (self->tabstops[i]) { self->cursor->x = i; break; }
|
||||
}
|
||||
if (i <= 0) self->cursor->x = 0;
|
||||
}
|
||||
if (before != self->cursor->x) tracker_cursor_changed(self->change_tracker);
|
||||
}
|
||||
|
||||
void
|
||||
screen_clear_tab_stop(Screen *self, unsigned int how) {
|
||||
switch(how) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user