diff options
| -rw-r--r-- | view.c | 40 | ||||
| -rw-r--r-- | view.h | 2 | ||||
| -rw-r--r-- | vis.c | 4 |
3 files changed, 2 insertions, 44 deletions
@@ -519,46 +519,6 @@ View *view_new(Text *text, ViewEvent *events) { void view_ui(View *view, UiWin* ui) { view->ui = ui; } -size_t view_char_prev(View *view) { - Cursor *cursor = &view->cursor; - Line *line = cursor->line; - - do { - if (cursor->col == 0) { - if (!line->prev) - return cursor->pos; - cursor->line = line = line->prev; - cursor->col = MIN(line->width, view->width - 1); - cursor->row--; - } else { - cursor->col--; - } - } while (line->cells[cursor->col].len == 0); - - cursor->pos -= line->cells[cursor->col].len; - return view_cursor_update(view); -} - -size_t view_char_next(View *view) { - Cursor *cursor = &view->cursor; - Line *line = cursor->line; - - do { - cursor->pos += line->cells[cursor->col].len; - if ((line->width == view->width && cursor->col == view->width - 1) || - cursor->col == line->width) { - if (!line->next) - return cursor->pos; - cursor->line = line = line->next; - cursor->row++; - cursor->col = 0; - } else { - cursor->col++; - } - } while (line->cells[cursor->col].len == 0); - - return view_cursor_update(view); -} static size_t view_cursor_set(View *view, Line *line, int col) { int row = 0; @@ -54,8 +54,6 @@ void view_tabwidth_set(View*, int tabwidth); /* cursor movements which also update selection if one is active. * they return new cursor postion */ -size_t view_char_next(View*); -size_t view_char_prev(View*); size_t view_line_down(View*); size_t view_line_up(View*); size_t view_screenline_down(View*); @@ -184,8 +184,8 @@ static Movement moves[] = { [MOVE_LINE_NEXT] = { .txt = text_line_next, .type = LINEWISE }, [MOVE_LINE] = { .txt = line, .type = LINEWISE|IDEMPOTENT|JUMP}, [MOVE_COLUMN] = { .txt = column, .type = CHARWISE|IDEMPOTENT}, - [MOVE_CHAR_PREV] = { .view = view_char_prev }, - [MOVE_CHAR_NEXT] = { .view = view_char_next }, + [MOVE_CHAR_PREV] = { .txt = text_char_prev }, + [MOVE_CHAR_NEXT] = { .txt = text_char_next }, [MOVE_WORD_START_PREV] = { .txt = text_word_start_prev, .type = CHARWISE }, [MOVE_WORD_START_NEXT] = { .txt = text_word_start_next, .type = CHARWISE }, [MOVE_WORD_END_PREV] = { .txt = text_word_end_prev, .type = CHARWISE|INCLUSIVE }, |
