aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vterm-module.c17
-rw-r--r--vterm-module.h3
2 files changed, 6 insertions, 14 deletions
diff --git a/vterm-module.c b/vterm-module.c
index 9e9fa26..984a613 100644
--- a/vterm-module.c
+++ b/vterm-module.c
@@ -211,16 +211,9 @@ static void refresh_screen(Term *term, emacs_env *env) {
term->invalid_end = -1;
}
-static void refresh_size(Term *term, emacs_env *env) {
- if (!term->pending_resize) {
- return;
- }
-
- term->pending_resize = false;
- int width, height;
- vterm_get_size(term->vt, &height, &width);
- term->invalid_start = 0;
- term->invalid_end = height;
+static int term_resize(int rows, int cols, void *term) {
+ invalidate_terminal(term, 0, rows);
+ return 1;
}
// Refresh the scrollback of an invalidated terminal.
@@ -335,7 +328,7 @@ static VTermScreenCallbacks vterm_screen_callbacks = {
.moverect = term_moverect,
.movecursor = term_movecursor,
.settermprop = term_settermprop,
- /* .bell = term_bell, */
+ .resize = term_resize,
.sb_pushline = term_sb_push,
.sb_popline = term_sb_pop,
};
@@ -631,10 +624,8 @@ static emacs_value Fvterm_set_size(emacs_env *env, ptrdiff_t nargs,
vterm_get_size(term->vt, &old_rows, &old_cols);
if (cols != old_cols || rows != old_rows) {
- term->pending_resize = true;
vterm_set_size(term->vt, rows, cols);
vterm_screen_flush_damage(term->vts);
- invalidate_terminal(term, -1, -1);
term_redraw(term, env);
}
diff --git a/vterm-module.h b/vterm-module.h
index fe3be66..0934087 100644
--- a/vterm-module.h
+++ b/vterm-module.h
@@ -45,7 +45,6 @@ typedef struct Term {
int sb_pending;
int invalid_start, invalid_end; // invalid rows in libvterm screen
- bool pending_resize; // pending width/height
bool is_invalidated;
Cursor cursor;
@@ -76,6 +75,8 @@ static void term_process_key(Term *term, unsigned char *key, size_t len,
VTermModifier modifier);
static void term_put_caret(Term *term, emacs_env *env, int row, int col,
int offset);
+static void invalidate_terminal(Term *term, int start_row, int end_row);
+static void refresh_size(Term *term);
static void term_finalize(void *object);
static emacs_value Fvterm_new(emacs_env *env, ptrdiff_t nargs,