From 3ae52c8cfdb1f8d6e887e9c8c980bbbec7fcb246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Tom=C3=A1s?= Date: Tue, 26 May 2020 03:25:05 -0300 Subject: Add partial support for utf-8 --- buffer.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 buffer.cpp (limited to 'buffer.cpp') 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++; + } + } + +}; + -- cgit v1.2.3