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. --- editor.h | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) (limited to 'editor.h') diff --git a/editor.h b/editor.h index ba7d3aa..9af1254 100644 --- a/editor.h +++ b/editor.h @@ -15,22 +15,6 @@ typedef struct EditorWin EditorWin; #include "syntax.h" #include "ring-buffer.h" - -typedef struct { - size_t index; /* #number of changes */ - size_t pos; /* where the current change occured */ -} ChangeList; - -struct EditorWin { - Editor *editor; /* editor instance to which this window belongs */ - UiWin *ui; - Text *text; /* underlying text management */ - Win *win; /* window for the text area */ - RingBuffer *jumplist; /* LRU jump management */ - ChangeList changelist; /* state for iterating through least recently changes */ - EditorWin *prev, *next; /* neighbouring windows */ -}; - enum Reg { REG_a, REG_b, @@ -91,10 +75,37 @@ enum Mark { MARK_z, MARK_SELECTION_START, MARK_SELECTION_END, + MARK_LAST, +}; + + +typedef struct VisText VisText; + +struct VisText { + Text *data; + int refcount; + Mark marks[MARK_LAST]; + VisText *next, *prev; +}; + +typedef struct { + size_t index; /* #number of changes */ + size_t pos; /* where the current change occured */ +} ChangeList; + +struct EditorWin { + Editor *editor; /* editor instance to which this window belongs */ + UiWin *ui; + VisText *text; /* underlying text management */ + Win *win; /* window for the text area */ + RingBuffer *jumplist; /* LRU jump management */ + ChangeList changelist; /* state for iterating through least recently changes */ + EditorWin *prev, *next; /* neighbouring windows */ }; struct Editor { Ui *ui; + VisText *texts; EditorWin *windows; /* list of windows */ EditorWin *win; /* currently active window */ Syntax *syntaxes; /* NULL terminated array of syntax definitions */ -- cgit v1.2.3