From bf08e4e2b69a391e72edc57735a5095af621f92c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Thu, 7 Aug 2014 13:38:57 +0200 Subject: Add function to query line-numer <-> byte offset mapping --- editor.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'editor.h') diff --git a/editor.h b/editor.h index e8d5a44..71829b3 100644 --- a/editor.h +++ b/editor.h @@ -17,6 +17,7 @@ typedef struct { editor_iterator_next(&it)) Editor *editor_load(const char *file); +const char *editor_filename(Editor*); bool editor_insert(Editor*, size_t pos, const char *data); bool editor_insert_raw(Editor*, size_t pos, const char *data, size_t len); bool editor_delete(Editor*, size_t pos, size_t len); @@ -26,6 +27,9 @@ void editor_snapshot(Editor*); bool editor_undo(Editor*); bool editor_redo(Editor*); +size_t editor_pos_by_lineno(Editor*, size_t lineno); +size_t editor_lineno_by_pos(Editor*, size_t pos); + size_t editor_bytes_get(Editor*, size_t pos, size_t len, char *buf); Iterator editor_iterator_get(Editor*, size_t pos); -- cgit v1.2.3