Skip to content

Commit

Permalink
vis: fix forceful redraw <C-l>
Browse files Browse the repository at this point in the history
  • Loading branch information
martanne committed Dec 20, 2015
1 parent cddf179 commit 8572b58
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 6 additions & 0 deletions ui-curses.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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*);
Expand Down
4 changes: 4 additions & 0 deletions vis.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions vis.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 8572b58

Please sign in to comment.