vis

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

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

commit e342bad44ae62879d26cf44573d3704f9399bd53
parent 1b36c258781d814e1baf7557d47e2e98a8ba0ac2
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Tue,  6 Jan 2015 14:05:17 +0100

Fix some compiler warnings

Diffstat:
Mconfig.def.h | 5+++--
Mvis.c | 4++--
Mwindow.c | 2+-
3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -22,8 +22,6 @@ * if no binding is found, mode->input(...) is called and the user entered * keys are passed as argument. this is used to change the document content. */ -static Mode vis_modes[]; - enum { VIS_MODE_BASIC, VIS_MODE_MARK, @@ -43,8 +41,11 @@ enum { VIS_MODE_INSERT_REGISTER, VIS_MODE_INSERT, VIS_MODE_REPLACE, + VIS_MODE_LAST, }; +static Mode vis_modes[VIS_MODE_LAST]; + /* command recognized at the ':'-prompt. tested top to bottom, first match wins. */ static Command cmds[] = { { "^bd(elete)?!?$", cmd_bdelete, false }, diff --git a/vis.c b/vis.c @@ -1110,7 +1110,7 @@ static void insert(const Arg *arg) { } static void insert_tab(const Arg *arg) { - return insert(&(const Arg){ .s = expand_tab() }); + insert(&(const Arg){ .s = expand_tab() }); } static void copy_indent_from_previous_line(Win *win, Text *text) { @@ -1946,7 +1946,7 @@ static Key getkey(void) { int len = 1; unsigned char keychar = keycode; if (ISASCII(keychar)) len = 1; - else if (keychar == '\e' || keychar >= 0xFC) len = 6; + else if (keychar == 0x1B || keychar >= 0xFC) len = 6; else if (keychar >= 0xF8) len = 5; else if (keychar >= 0xF0) len = 4; else if (keychar >= 0xE0) len = 3; diff --git a/window.c b/window.c @@ -194,8 +194,8 @@ static bool window_addch(Win *win, Char *c) { if (!win->line) return false; - Cell empty = {}; int width; + Cell empty = { .len = 0, .data = '\0' }; size_t lineno = win->line->lineno; switch (c->wchar) {