aboutsummaryrefslogtreecommitdiff
path: root/view.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-06-30 11:37:00 +0200
committerMarc André Tanner <mat@brain-dump.org>2015-06-30 11:37:00 +0200
commit4af9fe66851a42c20c550f2c59aa64d7a327c9ff (patch)
tree5bc43ab92be87d8749ad258beb57271785ec6d24 /view.c
parent60fe132d6c59d54021091af8e5aa09fcd4704562 (diff)
downloadvis-4af9fe66851a42c20c550f2c59aa64d7a327c9ff.tar.gz
vis-4af9fe66851a42c20c550f2c59aa64d7a327c9ff.tar.xz
Perform character prev/next movements based on Text not View
While it is slower, it allows to move to characters which are currently not visible. This will be handy when experimenting with multiple cursors.
Diffstat (limited to 'view.c')
-rw-r--r--view.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/view.c b/view.c
index 85e5c41..d49c417 100644
--- a/view.c
+++ b/view.c
@@ -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;