22f4252e25bc04323d743b13be0b371b1d4605df
[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         int term_width, term_height;
31 };
32
33 struct vi_buffer {
34         struct visor *vi;
35         char *path;
36         struct vi_buffer *next, *prev;
37
38         vi_addr cursor, view_start;
39         int view_xscroll;
40
41         vi_file *fp;
42         int file_mapped;
43
44         char *orig;
45         unsigned long orig_size;
46         char *add;
47         int add_size, add_max;
48
49         struct vi_span *spans;
50         int num_spans, max_spans;
51 };
52
53 enum { SPAN_ORIG, SPAN_ADD };
54
55 #endif  /* VIMPL_H_ */