aboutsummaryrefslogtreecommitdiff
path: root/view.h
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-06-10 15:03:46 +0200
committerMarc André Tanner <mat@brain-dump.org>2017-06-15 15:51:42 +0200
commit708216769c7cdf02ce3f69785a4356efd7dea0f7 (patch)
tree19f8faad6ff334d3d09d1f41ab1070a52bdbc54c /view.h
parent0df87384ac791bbf85cf4b3d386fb851e5b87de4 (diff)
downloadvis-708216769c7cdf02ce3f69785a4356efd7dea0f7.tar.gz
vis-708216769c7cdf02ce3f69785a4356efd7dea0f7.tar.xz
vis: promote selections to first class primitives
This unifies cursors and selections. The cursor are now represendted as singleton selections.
Diffstat (limited to 'view.h')
-rw-r--r--view.h22
1 files changed, 6 insertions, 16 deletions
diff --git a/view.h b/view.h
index a6d455e..833252a 100644
--- a/view.h
+++ b/view.h
@@ -6,7 +6,7 @@
typedef struct View View;
typedef struct Cursor Cursor;
-typedef struct Selection Selection;
+typedef Cursor Selection;
#include "text.h"
#include "ui.h"
@@ -162,30 +162,20 @@ void view_cursors_place(Cursor*, size_t line, size_t col);
/* start selected area at current cursor position. further cursor movements
* will affect the selected region. */
void view_cursors_selection_start(Cursor*);
-/* detach cursor from selection, further cursor movements will not affect
- * the selected region. */
-void view_cursors_selection_stop(Cursor*);
/* clear selection associated with this cursor (if any) */
void view_cursors_selection_clear(Cursor*);
/* move cursor position from one end of the selection to the other */
void view_cursors_selection_swap(Cursor*);
-/* move cursor to the end/boundary of the associated selection */
-void view_cursors_selection_sync(Cursor*);
-/* restore previous used selection of this cursor */
-void view_cursors_selection_restore(Cursor*);
/* get/set the selected region associated with this cursor */
Filerange view_cursors_selection_get(Cursor*);
void view_cursors_selection_set(Cursor*, const Filerange*);
-Selection *view_selections_new(View*, Cursor*);
-void view_selections_free(Selection*);
+void view_cursors_selection_save(Selection*);
+bool view_cursors_selection_restore(Selection*);
+
+bool view_selection_anchored(Cursor*);
+
void view_selections_clear(View*);
-void view_selections_swap(Selection*);
-Selection *view_selections(View*);
-Selection *view_selections_prev(Selection*);
-Selection *view_selections_next(Selection*);
-Filerange view_selections_get(Selection*);
-void view_selections_set(Selection*, const Filerange*);
Text *view_text(View*);
/* get number of columns, that is maximal number of cursors on a line */