From b366f55f29af3775c055115572dd84873b1921e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 28 Jul 2015 12:10:22 +0200 Subject: vis: use multiple cursor/selection infrastructure This commits introduces the following keybindings, in normal mode: CTRL-N select word the cursor is currently over, switch to visual mode CTRL-P remove least recently added cursor ESC if a selection is active, clear it. Otherwise dispose all but the primary cursor. In visual mode: CTRL-N create new cursor and select next word matching current selection CTRL-X clear (skip) current selection, but select next matching word CTRL-P remove least recently added cursor --- view.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'view.c') diff --git a/view.c b/view.c index 4af93f8..ff3ab42 100644 --- a/view.c +++ b/view.c @@ -912,6 +912,17 @@ void view_cursors_free(Cursor *c) { free(c); } +void view_cursors_dispose(Cursor *c) { + if (!c) + return; + View *view = c->view; + if (view->cursors && view->cursors->next) { + view_selections_free(c->sel); + view_cursors_free(c); + view_draw(view); + } +} + Cursor *view_cursors(View *view) { return view->cursors; } -- cgit v1.2.3