diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-04-05 10:10:47 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-04-05 19:58:45 +0200 |
| commit | 164527b74aa6cd04bd50c36399bc14ab90073bcf (patch) | |
| tree | 53d61af1dc32bb5bfaaa94d06c02bfd521df2de8 /editor.h | |
| parent | 1304c0680b8db9d8526eb36f0b563d534703338b (diff) | |
| download | vis-164527b74aa6cd04bd50c36399bc14ab90073bcf.tar.gz vis-164527b74aa6cd04bd50c36399bc14ab90073bcf.tar.xz | |
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.
Diffstat (limited to 'editor.h')
| -rw-r--r-- | editor.h | 43 |
1 files changed, 27 insertions, 16 deletions
@@ -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 */ |
