From 0ec4c6896358fa49364a9c2e11f982bd31f825d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 7 Apr 2015 14:08:06 +0200 Subject: Show cursor in visual mode --- config.def.h | 2 ++ window.c | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/config.def.h b/config.def.h index 28153aa..aa079d7 100644 --- a/config.def.h +++ b/config.def.h @@ -469,6 +469,8 @@ static void vis_mode_visual_line_leave(Mode *new) { if (!new->visual) { window_selection_clear(vis->win->win); vis_modes[VIS_MODE_OPERATOR].parent = &vis_modes[VIS_MODE_MOVE]; + } else { + window_cursor_to(vis->win->win, window_cursor_get(vis->win->win)); } } diff --git a/window.c b/window.c index dbe4bed..ef32e82 100644 --- a/window.c +++ b/window.c @@ -76,7 +76,6 @@ void window_selection_clear(Win *win) { win->sel = text_range_empty(); window_draw(win); window_cursor_update(win); - curs_set(1); } /* reset internal window data structures (cell matrix, line offsets etc.) */ @@ -120,8 +119,11 @@ Filerange window_selection_get(Win *win) { } void window_selection_set(Win *win, Filerange *sel) { + Cursor *cursor = &win->cursor; win->sel = *sel; window_draw(win); + if (win->ui) + win->ui->cursor_to(win->ui, cursor->col, cursor->row); } Filerange window_viewport_get(Win *win) { @@ -841,9 +843,10 @@ void window_scroll_to(Win *win, size_t pos) { void window_selection_start(Win *win) { if (win->sel.start != EPOS && win->sel.end != EPOS) return; - win->sel.start = win->sel.end = window_cursor_get(win); + size_t pos = window_cursor_get(win); + win->sel.start = win->sel.end = pos; window_draw(win); - curs_set(0); + window_cursor_to(win, pos); } void window_syntax_set(Win *win, Syntax *syntax) { -- cgit v1.2.3