summaryrefslogtreecommitdiff
path: root/buffer.cpp
blob: 027ffca81f096614a4feb08c3c320096d70dec0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
struct Buffer {
	const char *name;
	Point start;
	Point cursor;

	Buffer(const char *name) : name(name), start(), cursor(start) {}

	void prev_line(int window_width) {
		cursor--;
		cursor--;
		cursor.rseek('\n', window_width - 2);
		if (cursor.element() == '\n') {
			cursor++;
		}
	}

	void next_line(int window_width) {
		cursor.seek('\n', window_width);
		if (cursor.element() == '\n') {
			cursor++;
		}
	}

};