c7b8ab4dec54f7816552475fdab2b86bb39c5a54
[visor] / libvisor / src / vimpl.h
1 /*
2 visor - lightweight system-independent embeddable text editor framework
3 Copyright (C)  2019 John Tsiombikas <nuclear@member.fsf.org>
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 */
18 #ifndef VIMPL_H_
19 #define VIMPL_H_
20
21 #include "visor.h"
22
23 struct visor {
24         struct vi_fileops fop;
25         struct vi_buffer *buflist;      /* circular linked list of buffers cur first */
26         struct vi_alloc mm;
27         struct vi_ttyops tty;
28         void *tty_cls;
29 };
30
31 struct vi_buffer {
32         struct visor *vi;
33         char *path;
34         struct vi_buffer *next, *prev;
35
36         vi_addr cursor, view_start;
37         int view_xscroll;
38
39         vi_file *fp;
40         int file_mapped;
41
42         char *orig;
43         unsigned long orig_size;
44         char *add;
45         int add_size, add_max;
46
47         struct vi_span *spans;
48         int num_spans, max_spans;
49 };
50
51 enum { SPAN_ORIG, SPAN_ADD };
52
53 #endif  /* VIMPL_H_ */