vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit a070712e64e815404105635e04ac44a78bfa70b8 parent 8db7583abef74bc2ff8784e8f11fc4427b4aa3bb Author: Marc André Tanner <mat@brain-dump.org> Date: Tue, 9 Sep 2014 21:27:55 +0200 Remove trailing whitespaces (sed 's/[ \t]*$//') Diffstat:
| M | config.def.h | | | 4 | ++-- |
| M | editor.c | | | 4 | ++-- |
| M | editor.h | | | 4 | ++-- |
| M | register.h | | | 4 | ++-- |
| M | text-motions.c | | | 2 | +- |
| M | text-motions.h | | | 6 | +++--- |
| M | vis.c | | | 8 | ++++---- |
| M | window.c | | | 4 | ++-- |
| M | window.h | | | 6 | +++--- |
9 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/config.def.h b/config.def.h @@ -474,7 +474,7 @@ static Mode vis_modes[] = { .parent = &vis_modes[VIS_MODE_MARK], .bindings = vis_marks_line, }, - [VIS_MODE_MOVE] = { + [VIS_MODE_MOVE] = { .name = "MOVE", .parent = &vis_modes[VIS_MODE_MARK_LINE], .bindings = vis_movements, @@ -485,7 +485,7 @@ static Mode vis_modes[] = { .parent = &vis_modes[VIS_MODE_MOVE], .bindings = vis_inner_textobjs, }, - [VIS_MODE_TEXTOBJ] = { + [VIS_MODE_TEXTOBJ] = { .name = "TEXTOBJ", .common_prefix = true, .parent = &vis_modes[VIS_MODE_INNER_TEXTOBJ], diff --git a/editor.c b/editor.c @@ -55,7 +55,7 @@ static void editor_windows_arrange_horizontal(Editor *ed) { int n = 0, x = 0, y = 0; for (EditorWin *win = ed->windows; win; win = win->next) n++; - int height = ed->height / n; + int height = ed->height / n; for (EditorWin *win = ed->windows; win; win = win->next) { editor_window_resize(win, ed->width, win->next ? height : ed->height - y); editor_window_move(win, x, y); @@ -290,7 +290,7 @@ bool editor_window_new(Editor *ed, const char *filename) { } } } - + editor_draw(ed); return true; diff --git a/editor.h b/editor.h @@ -128,8 +128,8 @@ struct Syntax { /* a syntax definition */ }; Editor *editor_new(int width, int height); -void editor_free(Editor*); -void editor_resize(Editor*, int width, int height); +void editor_free(Editor*); +void editor_resize(Editor*, int width, int height); void editor_draw(Editor*); void editor_update(Editor*); void editor_insert_key(Editor*, const char *c, size_t len); diff --git a/register.h b/register.h @@ -13,9 +13,9 @@ typedef struct { } Register; bool register_alloc(Register *reg, size_t size); -void register_free(Register *reg); +void register_free(Register *reg); bool register_store(Register *reg, const char *data, size_t len); bool register_put(Register *reg, Text *txt, Filerange *range); -bool register_append(Register *reg, Text *txt, Filerange *range); +bool register_append(Register *reg, Text *txt, Filerange *range); #endif diff --git a/text-motions.c b/text-motions.c @@ -125,7 +125,7 @@ size_t text_word_boundry_start_prev(Text *txt, size_t pos, int (*isboundry)(int) do pos = it.pos; while (text_iterator_char_prev(&it, &c) && !isboundry(c)); return pos; } - + size_t text_word_boundry_end_next(Text *txt, size_t pos, int (*isboundry)(int)) { char c; Iterator it = text_iterator_get(txt, pos); diff --git a/text-motions.h b/text-motions.h @@ -33,7 +33,7 @@ size_t text_word_end_next(Text*, size_t pos); size_t text_word_end_prev(Text*, size_t pos); size_t text_word_start_next(Text*, size_t pos); size_t text_word_start_prev(Text*, size_t pos); -/* +/* * These are variants of the above with the additional possibility to implement * a custom word detection logic. Can be used to implment the equivalent of a what * vim reconizes as a word (lowercase). @@ -52,13 +52,13 @@ size_t text_word_boundry_start_prev(Text*, size_t pos, int (*isboundry)(int)); size_t text_sentence_next(Text*, size_t pos); size_t text_sentence_prev(Text*, size_t pos); /* TODO: implement the following semantics - * A paragraph begins after each empty line. A section boundary is also a + * A paragraph begins after each empty line. A section boundary is also a * paragraph boundary. Note that a blank line (only containing white space) * is NOT a paragraph boundary. */ size_t text_paragraph_next(Text*, size_t pos); size_t text_paragraph_prev(Text*, size_t pos); -/* A section begins after a form-feed in the first column. +/* A section begins after a form-feed in the first column. size_t text_section_next(Text*, size_t pos); size_t text_section_prev(Text*, size_t pos); */ diff --git a/vis.c b/vis.c @@ -49,7 +49,7 @@ struct Mode { bool common_prefix; void (*enter)(Mode *old); void (*leave)(Mode *new); - bool (*unknown)(Key *key0, Key *key1); /* unknown key for this mode, return value determines whether parent modes will be checked */ + bool (*unknown)(Key *key0, Key *key1); /* unknown key for this mode, return value determines whether parent modes will be checked */ void (*input)(const char *str, size_t len); /* unknown key for this an all parent modes */ void (*idle)(void); }; @@ -516,7 +516,7 @@ static void prompt_enter(const Arg *arg) { } static void prompt_up(const Arg *arg) { - + } static void prompt_down(const Arg *arg) { @@ -971,7 +971,7 @@ int main(int argc, char *argv[]) { KeyBinding *action = keybinding(mode, key_mod ? key_mod : &key, key_mod ? &key : NULL); if (!action && key_mod) { - /* second char of a combination was invalid, search again without the prefix */ + /* second char of a combination was invalid, search again without the prefix */ action = keybinding(mode, &key, NULL); key_mod = NULL; } @@ -989,7 +989,7 @@ int main(int argc, char *argv[]) { if (key.code) continue; - + if (mode->input) mode->input(key.str, strlen(key.str)); if (mode->idle) diff --git a/window.c b/window.c @@ -438,7 +438,7 @@ void window_draw(Win *win) { } bool window_resize(Win *win, int width, int height) { - if (wresize(win->win, height, width) == ERR) + if (wresize(win->win, height, width) == ERR) return false; // TODO: only grow memory area win->height = height; @@ -737,7 +737,7 @@ void window_syntax_set(Win *win, Syntax *syntax) { } Syntax *window_syntax_get(Win *win) { - return win->syntax; + return win->syntax; } void window_cursor_watch(Win *win, void (*cursor_moved)(Win*, void *), void *data) { diff --git a/window.h b/window.h @@ -32,7 +32,7 @@ size_t window_line_down(Win*); size_t window_line_up(Win*); size_t window_cursor_get(Win*); -void window_cursor_getxy(Win*, size_t *lineno, size_t *col); +void window_cursor_getxy(Win*, size_t *lineno, size_t *col); void window_scroll_to(Win*, size_t pos); void window_cursor_to(Win*, size_t pos); void window_selection_start(Win*); @@ -41,7 +41,7 @@ Filerange window_selection_get(Win*); void window_selection_clear(Win*); Filerange window_viewport_get(Win*); void window_syntax_set(Win*, Syntax*); -Syntax *window_syntax_get(Win*); -void window_cursor_watch(Win *win, void (*cursor_moved)(Win*, void*), void *data); +Syntax *window_syntax_get(Win*); +void window_cursor_watch(Win *win, void (*cursor_moved)(Win*, void*), void *data); #endif