mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-05 07:15:30 -04:00
terminal: add term_linefeed() and term_reverse_index()
linefeed moves cursor down one row (columns stays the same), or, if the cursor is at the last row, scrolls up one row. reverse_index does the opposite; it moves the cursor *up* one row, or, if the cursor is at the top row, scrolls *down* one row.
This commit is contained in:
parent
96bd55f7c4
commit
3ab68c575b
2 changed files with 21 additions and 0 deletions
18
terminal.c
18
terminal.c
|
|
@ -219,6 +219,24 @@ term_scroll_reverse(struct terminal *term, int rows)
|
||||||
term_scroll_reverse_partial(term, term->scroll_region, rows);
|
term_scroll_reverse_partial(term, term->scroll_region, rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
term_linefeed(struct terminal *term)
|
||||||
|
{
|
||||||
|
if (term->cursor.row == term->scroll_region.end - 1)
|
||||||
|
term_scroll(term, 1);
|
||||||
|
else
|
||||||
|
term_cursor_down(term, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
term_reverse_index(struct terminal *term)
|
||||||
|
{
|
||||||
|
if (term->cursor.row == term->scroll_region.start)
|
||||||
|
term_scroll_reverse(term, 1);
|
||||||
|
else
|
||||||
|
term_cursor_up(term, 1);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
linux_mouse_button_to_x(int button)
|
linux_mouse_button_to_x(int button)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -269,6 +269,9 @@ void term_scroll_partial(
|
||||||
void term_scroll_reverse_partial(
|
void term_scroll_reverse_partial(
|
||||||
struct terminal *term, struct scroll_region region, int rows);
|
struct terminal *term, struct scroll_region region, int rows);
|
||||||
|
|
||||||
|
void term_linefeed(struct terminal *term);
|
||||||
|
void term_reverse_index(struct terminal *term);
|
||||||
|
|
||||||
void term_mouse_down(struct terminal *term, int button, int row, int col,
|
void term_mouse_down(struct terminal *term, int button, int row, int col,
|
||||||
bool shift, bool alt, bool ctrl);
|
bool shift, bool alt, bool ctrl);
|
||||||
void term_mouse_up(struct terminal *term, int button, int row, int col,
|
void term_mouse_up(struct terminal *term, int button, int row, int col,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue