vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 96934dc010515c0f64f35e5cd44dd8d378ae9525
parent 877439f5bfe62313bd3fa7bad3eb6f3a806dee38
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sun, 20 Dec 2015 11:20:27 +0100

vis: fix forceful redraw <C-l>

Diffstat:
Mmain.c | 2+-
Mui-curses.c | 6++++++
Mui.h | 1+
Mvis.c | 4++++
Mvis.h | 1+
5 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/main.c b/main.c @@ -616,7 +616,7 @@ static KeyAction vis_action[] = { [VIS_ACTION_REDRAW] = { "editor-redraw", "Redraw current editor content", - call, { .f = vis_draw } + call, { .f = vis_redraw } }, [VIS_ACTION_REPLACE_CHAR] = { "replace-char", diff --git a/ui-curses.c b/ui-curses.c @@ -772,6 +772,11 @@ static void ui_draw(Ui *ui) { wnoutrefresh(stdscr); } +static void ui_redraw(Ui *ui) { + clear(); + ui_draw(ui); +} + static void ui_resize_to(Ui *ui, int width, int height) { UiCurses *uic = (UiCurses*)ui; uic->width = width; @@ -1111,6 +1116,7 @@ Ui *ui_curses_new(void) { .prompt_input = ui_prompt_input, .prompt_hide = ui_prompt_hide, .draw = ui_draw, + .redraw = ui_redraw, .arrange = ui_arrange, .die = ui_die, .info = ui_info, diff --git a/ui.h b/ui.h @@ -55,6 +55,7 @@ struct Ui { void (*info_hide)(Ui*); void (*arrange)(Ui*, enum UiLayout); void (*draw)(Ui*); + void (*redraw)(Ui*); void (*update)(Ui*); void (*suspend)(Ui*); const char* (*getkey)(Ui*); diff --git a/vis.c b/vis.c @@ -245,6 +245,10 @@ void vis_draw(Vis *vis) { vis->ui->draw(vis->ui); } +void vis_redraw(Vis *vis) { + vis->ui->redraw(vis->ui); +} + void vis_update(Vis *vis) { for (Win *win = vis->windows; win; win = win->next) view_update(win->view); diff --git a/vis.h b/vis.h @@ -45,6 +45,7 @@ Vis *vis_new(Ui*); void vis_free(Vis*); /* instructs the user interface to draw to an internal buffer */ void vis_draw(Vis*); +void vis_redraw(Vis*); /* flushes the state of the internal buffer to the output device */ void vis_update(Vis*); /* temporarily supsend the editor process, resumes upon receiving SIGCONT */