diff options
| author | Lukas Fürmetz <fuermetz@mailbox.org> | 2018-11-11 22:18:00 +0100 |
|---|---|---|
| committer | Lukas Fürmetz <fuermetz@mailbox.org> | 2018-11-11 22:18:00 +0100 |
| commit | 3e4c65ad13f6f84219c5d0a5afaa7c186cd9e0b2 (patch) | |
| tree | 6493f40e5e8d0d6cb0d54beff9d7b6a330a3662f | |
| parent | aabbe279baa722c6c115f1ebccb7383d3561979d (diff) | |
Replace goto with a if
| -rw-r--r-- | vterm-module.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/vterm-module.c b/vterm-module.c index a16ea2c..9274a06 100644 --- a/vterm-module.c +++ b/vterm-module.c @@ -197,19 +197,16 @@ static void refresh_screen(Term *term, emacs_env *env) { int height; int width; - if (term->invalid_end < term->invalid_start) { - goto end; + if (term->invalid_end >= term->invalid_start) { + vterm_get_size(term->vt, &height, &width); + + // Term height may have decreased before `invalid_end` reflects it. + int line_start = row_to_linenr(term, term->invalid_start); + goto_line(env, line_start); + delete_lines(env, line_start, term->invalid_end - term->invalid_start, true); + refresh_lines(term, env, term->invalid_start, term->invalid_end, width); } - vterm_get_size(term->vt, &height, &width); - - // Term height may have decreased before `invalid_end` reflects it. - int line_start = row_to_linenr(term, term->invalid_start); - goto_line(env, line_start); - delete_lines(env, line_start, term->invalid_end - term->invalid_start, true); - refresh_lines(term, env, term->invalid_start, term->invalid_end, width); - -end: term->invalid_start = INT_MAX; term->invalid_end = -1; } |
