mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-05 01:40:41 -05:00
commit
e36d907f3d
6 changed files with 60 additions and 4 deletions
|
|
@ -16,6 +16,13 @@
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
* Implement reverse auto-wrap (_auto\_left\_margin_, _bw_, in
|
||||||
|
terminfo). This mode can be enabled/disabled with `CSI ? 45 h` and
|
||||||
|
`CSI `45 l`. It is **enabled** by default
|
||||||
|
(https://codeberg.org/dnkl/foot/issues/150).
|
||||||
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
* Default value of the **scrollback.multiplier** option in `foot.ini`
|
* Default value of the **scrollback.multiplier** option in `foot.ini`
|
||||||
|
|
|
||||||
6
csi.c
6
csi.c
|
|
@ -399,6 +399,10 @@ decset_decrst(struct terminal *term, unsigned param, bool enable)
|
||||||
term->hide_cursor = !enable;
|
term->hide_cursor = !enable;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 45:
|
||||||
|
term->reverse_wrap = enable;
|
||||||
|
break;
|
||||||
|
|
||||||
case 1000:
|
case 1000:
|
||||||
if (enable)
|
if (enable)
|
||||||
term->mouse_tracking = MOUSE_CLICK;
|
term->mouse_tracking = MOUSE_CLICK;
|
||||||
|
|
@ -576,6 +580,7 @@ xtsave(struct terminal *term, unsigned param)
|
||||||
}
|
}
|
||||||
|
|
||||||
case 25: term->xtsave.show_cursor = !term->hide_cursor; break;
|
case 25: term->xtsave.show_cursor = !term->hide_cursor; break;
|
||||||
|
case 45: term->xtsave.reverse_wrap = term->reverse_wrap; break;
|
||||||
case 1000: term->xtsave.mouse_click = term->mouse_tracking == MOUSE_CLICK; break;
|
case 1000: term->xtsave.mouse_click = term->mouse_tracking == MOUSE_CLICK; break;
|
||||||
case 1001: break;
|
case 1001: break;
|
||||||
case 1002: term->xtsave.mouse_drag = term->mouse_tracking == MOUSE_DRAG; break;
|
case 1002: term->xtsave.mouse_drag = term->mouse_tracking == MOUSE_DRAG; break;
|
||||||
|
|
@ -606,6 +611,7 @@ xtrestore(struct terminal *term, unsigned param)
|
||||||
case 9: /* enable = term->xtsave.mouse_x10; break; */ return;
|
case 9: /* enable = term->xtsave.mouse_x10; break; */ return;
|
||||||
case 12: enable = term->xtsave.cursor_blink; break;
|
case 12: enable = term->xtsave.cursor_blink; break;
|
||||||
case 25: enable = term->xtsave.show_cursor; break;
|
case 25: enable = term->xtsave.show_cursor; break;
|
||||||
|
case 45: enable = term->xtsave.reverse_wrap; break;
|
||||||
case 1000: enable = term->xtsave.mouse_click; break;
|
case 1000: enable = term->xtsave.mouse_click; break;
|
||||||
case 1001: return;
|
case 1001: return;
|
||||||
case 1002: enable = term->xtsave.mouse_drag; break;
|
case 1002: enable = term->xtsave.mouse_drag; break;
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ foot-direct|foot with direct color indexing,
|
||||||
foot+base|foot base fragment,
|
foot+base|foot base fragment,
|
||||||
am,
|
am,
|
||||||
bce,
|
bce,
|
||||||
|
bw,
|
||||||
ccc,
|
ccc,
|
||||||
km,
|
km,
|
||||||
mir,
|
mir,
|
||||||
|
|
|
||||||
43
terminal.c
43
terminal.c
|
|
@ -904,6 +904,7 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
|
||||||
: FCFT_SUBPIXEL_NONE),
|
: FCFT_SUBPIXEL_NONE),
|
||||||
.cursor_keys_mode = CURSOR_KEYS_NORMAL,
|
.cursor_keys_mode = CURSOR_KEYS_NORMAL,
|
||||||
.keypad_keys_mode = KEYPAD_NUMERICAL,
|
.keypad_keys_mode = KEYPAD_NUMERICAL,
|
||||||
|
.reverse_wrap = true,
|
||||||
.auto_margin = true,
|
.auto_margin = true,
|
||||||
.window_title_stack = tll_init(),
|
.window_title_stack = tll_init(),
|
||||||
.scale = 1,
|
.scale = 1,
|
||||||
|
|
@ -1394,6 +1395,7 @@ term_reset(struct terminal *term, bool hard)
|
||||||
term->keypad_keys_mode = KEYPAD_NUMERICAL;
|
term->keypad_keys_mode = KEYPAD_NUMERICAL;
|
||||||
term->reverse = false;
|
term->reverse = false;
|
||||||
term->hide_cursor = false;
|
term->hide_cursor = false;
|
||||||
|
term->reverse_wrap = true;
|
||||||
term->auto_margin = true;
|
term->auto_margin = true;
|
||||||
term->insert_mode = false;
|
term->insert_mode = false;
|
||||||
term->bracketed_paste = false;
|
term->bracketed_paste = false;
|
||||||
|
|
@ -1728,9 +1730,44 @@ term_cursor_home(struct terminal *term)
|
||||||
void
|
void
|
||||||
term_cursor_left(struct terminal *term, int count)
|
term_cursor_left(struct terminal *term, int count)
|
||||||
{
|
{
|
||||||
int move_amount = min(term->grid->cursor.point.col, count);
|
assert(count >= 0);
|
||||||
term->grid->cursor.point.col -= move_amount;
|
int new_col = term->grid->cursor.point.col - count;
|
||||||
assert(term->grid->cursor.point.col >= 0);
|
|
||||||
|
/* Reverse wrap */
|
||||||
|
if (unlikely(new_col < 0)) {
|
||||||
|
if (unlikely(term->reverse_wrap && term->auto_margin)) {
|
||||||
|
|
||||||
|
/* Number of rows to reverse wrap through */
|
||||||
|
int row_count = (abs(new_col) - 1) / term->cols + 1;
|
||||||
|
|
||||||
|
/* Row number cursor will end up on */
|
||||||
|
int new_row_no = term->grid->cursor.point.row - row_count;
|
||||||
|
|
||||||
|
/* New column number */
|
||||||
|
new_col = term->cols - ((abs(new_col) - 1) % term->cols + 1);
|
||||||
|
assert(new_col >= 0 && new_col < term->cols);
|
||||||
|
|
||||||
|
/* Don't back up past the scroll region */
|
||||||
|
/* TODO: should this be allowed? */
|
||||||
|
if (new_row_no < term->scroll_region.start) {
|
||||||
|
new_row_no = term->scroll_region.start;
|
||||||
|
new_col = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct row *new_row = grid_row(term->grid, new_row_no);
|
||||||
|
term->grid->cursor.point.col = new_col;
|
||||||
|
term->grid->cursor.point.row = new_row_no;
|
||||||
|
term->grid->cursor.lcf = false;
|
||||||
|
term->grid->cur_row = new_row;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reverse wrap disabled - don't let cursor move past first column */
|
||||||
|
new_col = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(new_col >= 0);
|
||||||
|
term->grid->cursor.point.col = new_col;
|
||||||
term->grid->cursor.lcf = false;
|
term->grid->cursor.lcf = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -237,6 +237,7 @@ struct terminal {
|
||||||
enum keypad_keys keypad_keys_mode;
|
enum keypad_keys keypad_keys_mode;
|
||||||
bool reverse;
|
bool reverse;
|
||||||
bool hide_cursor;
|
bool hide_cursor;
|
||||||
|
bool reverse_wrap;
|
||||||
bool auto_margin;
|
bool auto_margin;
|
||||||
bool insert_mode;
|
bool insert_mode;
|
||||||
bool bracketed_paste;
|
bool bracketed_paste;
|
||||||
|
|
@ -256,6 +257,7 @@ struct terminal {
|
||||||
uint32_t application_cursor_keys:1;
|
uint32_t application_cursor_keys:1;
|
||||||
uint32_t reverse:1;
|
uint32_t reverse:1;
|
||||||
uint32_t show_cursor:1;
|
uint32_t show_cursor:1;
|
||||||
|
uint32_t reverse_wrap:1;
|
||||||
uint32_t auto_margin:1;
|
uint32_t auto_margin:1;
|
||||||
uint32_t cursor_blink:1;
|
uint32_t cursor_blink:1;
|
||||||
uint32_t insert_mode:1;
|
uint32_t insert_mode:1;
|
||||||
|
|
|
||||||
5
vt.c
5
vt.c
|
|
@ -130,7 +130,10 @@ action_execute(struct terminal *term, uint8_t c)
|
||||||
|
|
||||||
case '\b':
|
case '\b':
|
||||||
/* backspace */
|
/* backspace */
|
||||||
term_cursor_left(term, 1);
|
if (term->grid->cursor.lcf)
|
||||||
|
term->grid->cursor.lcf = false;
|
||||||
|
else
|
||||||
|
term_cursor_left(term, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\t': {
|
case '\t': {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue