aboutsummaryrefslogtreecommitdiff
path: root/editor.c
diff options
context:
space:
mode:
Diffstat (limited to 'editor.c')
-rw-r--r--editor.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/editor.c b/editor.c
index 78f7916..85b366f 100644
--- a/editor.c
+++ b/editor.c
@@ -972,6 +972,21 @@ size_t editor_cursor_get(Editor *ed) {
return ed->win->cursor.pos;
}
+Text *editor_text_get(Editor *ed) {
+ return ed->win->text;
+}
+
+void editor_scroll_to(Editor *ed, size_t pos) {
+ Win *win = ed->win;
+ while (pos < win->start && scroll_line_up(win, 1));
+ while (pos > win->end && scroll_line_down(win, 1));
+ cursor_move_to(win, pos);
+}
+
+void editor_cursor_to(Editor *ed, size_t pos) {
+ cursor_move_to(ed->win, pos);
+}
+
size_t editor_selection_start(Editor *ed) {
return ed->win->sel.start = editor_cursor_get(ed);
}