From 164527b74aa6cd04bd50c36399bc14ab90073bcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sun, 5 Apr 2015 10:10:47 +0200 Subject: Introduce new struct VisText This adds yet another layer of indirection and stores vi related stuff which is associated with a given text but shared among all windows displaying it (e.g. marks). This will also help if one wants to keep texts arround which aren't currently displayed. --- text.c | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'text.c') diff --git a/text.c b/text.c index cd85734..553a3cb 100644 --- a/text.c +++ b/text.c @@ -118,7 +118,6 @@ struct Text { struct stat info; /* stat as proped on load time */ int fd; /* the file descriptor of the original mmap-ed data */ LineCache lines; /* mapping between absolute pos in bytes and logical line breaks */ - Mark marks[32]; /* a mark is a pointer into an underlying buffer */ int newlines; /* 0: unknown, 1: \n, -1: \r\n */ }; @@ -1159,29 +1158,6 @@ size_t text_mark_get(Text *txt, Mark mark) { return EPOS; } -void text_mark_intern_set(Text *txt, MarkIntern mark, size_t pos) { - if (mark < 0 || mark >= LENGTH(txt->marks)) - return; - txt->marks[mark] = text_mark_set(txt, pos); -} - -size_t text_mark_intern_get(Text *txt, MarkIntern mark) { - if (mark < 0 || mark >= LENGTH(txt->marks)) - return EPOS; - return text_mark_get(txt, txt->marks[mark]); -} - -void text_mark_intern_clear(Text *txt, MarkIntern mark) { - if (mark < 0 || mark >= LENGTH(txt->marks)) - return; - txt->marks[mark] = NULL; -} - -void text_mark_intern_clear_all(Text *txt) { - for (MarkIntern mark = 0; mark < LENGTH(txt->marks); mark++) - text_mark_intern_clear(txt, mark); -} - size_t text_history_get(Text *txt, size_t index) { for (Action *a = txt->current_action ? txt->current_action : txt->undo; a; a = a->next) { if (index-- == 0) { -- cgit v1.2.3