summaryrefslogtreecommitdiff
path: root/buffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'buffer.cpp')
-rw-r--r--buffer.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/buffer.cpp b/buffer.cpp
new file mode 100644
index 0000000..027ffca
--- /dev/null
+++ b/buffer.cpp
@@ -0,0 +1,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++;
+ }
+ }
+
+};
+