mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-06 07:15:30 -04:00
term: new function: term_autowrap()
Adds a linebreak (+ scroll if necessary) if we're in a deferred wrap and auto-margins are enabled. Return true when we wrapped, false otherwise.
This commit is contained in:
parent
f4be84871f
commit
686405b703
2 changed files with 16 additions and 0 deletions
15
terminal.c
15
terminal.c
|
|
@ -1192,6 +1192,21 @@ term_reverse_index(struct terminal *term)
|
||||||
term_cursor_up(term, 1);
|
term_cursor_up(term, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
term_autowrap(struct terminal *term)
|
||||||
|
{
|
||||||
|
if (unlikely(term->cursor.lcf) && term->auto_margin) {
|
||||||
|
if (term->cursor.point.row == term->scroll_region.end - 1) {
|
||||||
|
term_scroll(term, 1);
|
||||||
|
term_cursor_to(term, term->cursor.point.row, 0);
|
||||||
|
} else
|
||||||
|
term_cursor_to(term, term->cursor.point.row + 1, 0);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
term_reset_view(struct terminal *term)
|
term_reset_view(struct terminal *term)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -360,6 +360,7 @@ void term_scroll_reverse_partial(
|
||||||
|
|
||||||
void term_linefeed(struct terminal *term);
|
void term_linefeed(struct terminal *term);
|
||||||
void term_reverse_index(struct terminal *term);
|
void term_reverse_index(struct terminal *term);
|
||||||
|
bool term_autowrap(struct terminal *term);
|
||||||
|
|
||||||
void term_restore_cursor(struct terminal *term);
|
void term_restore_cursor(struct terminal *term);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue