mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-30 06:46:45 -04:00
term: use custom cursor movement functions when OSC-8 is active
Use runtime switchable function pointers for cursor movement functions. The “normal” once are not OSC-8 aware, while the *_osc8 are. OSC-8 aware means the cursor movement functions will “close” the currently open URL before moving the cursor, and then re-open the URL after having moved the cursor. This simulates SGR-like behavior for OSC-8 URLs; the URL “property” is only assigned to cells that are actually printed to. Closes #816
This commit is contained in:
parent
11e7539b84
commit
d19326c496
2 changed files with 169 additions and 43 deletions
29
terminal.h
29
terminal.h
|
|
@ -289,6 +289,13 @@ struct terminal {
|
|||
const struct config *conf;
|
||||
|
||||
void (*ascii_printer)(struct terminal *term, wchar_t c);
|
||||
struct {
|
||||
void (*to)(struct terminal *term, int row, int col);
|
||||
void (*left)(struct terminal *term, int count);
|
||||
void (*right)(struct terminal *term, int count);
|
||||
void (*up)(struct terminal *term, int count);
|
||||
void (*down)(struct terminal *term, int count);
|
||||
} cursor_move;
|
||||
|
||||
pid_t slave;
|
||||
int ptmx;
|
||||
|
|
@ -696,11 +703,23 @@ void term_erase_scrollback(struct terminal *term);
|
|||
|
||||
int term_row_rel_to_abs(const struct terminal *term, int row);
|
||||
void term_cursor_home(struct terminal *term);
|
||||
void term_cursor_to(struct terminal *term, int row, int col);
|
||||
void term_cursor_left(struct terminal *term, int count);
|
||||
void term_cursor_right(struct terminal *term, int count);
|
||||
void term_cursor_up(struct terminal *term, int count);
|
||||
void term_cursor_down(struct terminal *term, int count);
|
||||
|
||||
static inline void term_cursor_to(struct terminal *term, int row, int col) {
|
||||
term->cursor_move.to(term, row, col);
|
||||
}
|
||||
static inline void term_cursor_left(struct terminal *term, int count) {
|
||||
term->cursor_move.left(term, count);
|
||||
}
|
||||
static inline void term_cursor_right(struct terminal *term, int count) {
|
||||
term->cursor_move.right(term, count);
|
||||
}
|
||||
static inline void term_cursor_up(struct terminal *term, int count) {
|
||||
term->cursor_move.up(term, count);
|
||||
}
|
||||
static inline void term_cursor_down(struct terminal *term, int count) {
|
||||
term->cursor_move.down(term, count);
|
||||
}
|
||||
|
||||
void term_cursor_blink_update(struct terminal *term);
|
||||
|
||||
void term_print(struct terminal *term, wchar_t wc, int width);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue