diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-05-26 03:25:05 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2020-05-26 03:25:05 -0300 |
commit | 3ae52c8cfdb1f8d6e887e9c8c980bbbec7fcb246 (patch) | |
tree | 8e0bef9529ea4802b06d5d95ad5c749c2662acaa /buffer.cpp | |
parent | 98280238383dc390207827d09dc92e0459229134 (diff) | |
download | jet-3ae52c8cfdb1f8d6e887e9c8c980bbbec7fcb246.tar.gz jet-3ae52c8cfdb1f8d6e887e9c8c980bbbec7fcb246.zip |
Add partial support for utf-8
Diffstat (limited to 'buffer.cpp')
-rw-r--r-- | buffer.cpp | 25 |
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++; + } + } + +}; + |