summaryrefslogtreecommitdiff
path: root/buffer.cpp
blob: 93133803d62391759bd90c5eec05df0cbe6a8566 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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.rseek('\n', window_width - 1);
	}

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

};