diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-01-13 14:22:36 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-01-13 21:38:20 +0100 |
| commit | 5d54271403b1a90ed7ef81894ea0ff91d7a8c5f6 (patch) | |
| tree | a943c6a9084891310b5187a25edd2c2b255df580 | |
| parent | 8ca992e7a2d2f7be3b4e46a988443525575ca72d (diff) | |
| download | vis-5d54271403b1a90ed7ef81894ea0ff91d7a8c5f6.tar.gz vis-5d54271403b1a90ed7ef81894ea0ff91d7a8c5f6.tar.xz | |
view: introduce view_selection_get
It returns the range covered by the selection of the primary cursor.
| -rw-r--r-- | view.c | 4 | ||||
| -rw-r--r-- | view.h | 2 |
2 files changed, 6 insertions, 0 deletions
@@ -1301,6 +1301,10 @@ Selection *view_selections_next(Selection *s) { return s->next; } +Filerange view_selection_get(View *view) { + return view_selections_get(view->cursor->sel); +} + Filerange view_selections_get(Selection *s) { if (!s) return text_range_empty(); @@ -109,6 +109,8 @@ int view_colorcolumn_get(View*); CursorPos view_cursor_getpos(View*); /* get main cursor position in bytes from start of the file */ size_t view_cursor_get(View*); +/* get selection associated with primary cursor */ +Filerange view_selection_get(View*); /* moves window viewport in direction until pos is visible. should only be * used for short distances between current cursor position and destination */ void view_scroll_to(View*, size_t pos); |
