From 647dc4c030c0ee876d85de0447f4d706d600d3f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Mon, 28 Mar 2016 12:01:49 +0200 Subject: view: add infrastructure to iterate through cursor columns The number of columns i.e. maximal number of cursors located on the same line can be obtained by view_cursors_column_count. Column addressing is zero based, valid indexes are [0, max-1]. Assuming there is a cursor on every letter: a b c d e f g h i max column would be 3, and the following would iterate over the cursors forming the second column [c, e, h]: for (Cursor *c = view_cursors_column(view, 1); c; c = view_cursors_column_next(c, 1)) ... --- view.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'view.h') diff --git a/view.h b/view.h index e408cf7..6447032 100644 --- a/view.h +++ b/view.h @@ -179,4 +179,11 @@ Filerange view_selections_get(Selection*); void view_selections_set(Selection*, Filerange*); Text *view_text(View*); +/* get number of columns, that is maximal number of cursors on a line */ +int view_cursors_column_count(View*); +/* get first cursor in zero based column */ +Cursor *view_cursors_column(View*, int column); +/* get next cursor (i.e. on another line) in zero based column */ +Cursor *view_cursors_column_next(Cursor*, int column); + #endif -- cgit v1.2.3