summaryrefslogtreecommitdiff
path: root/src/client/cursor.cpp
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2020-08-05 20:09:25 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2020-08-05 20:09:25 -0300
commitbebe98b46283bf21954f5f0a4923d3add45e4d5b (patch)
treec82bcc39efd29b3e0ccac8bcfcf34f242796d0d7 /src/client/cursor.cpp
parent4bbbfb8e8139e690ea084b72ccc2de71fdca1e08 (diff)
downloadjet-bebe98b46283bf21954f5f0a4923d3add45e4d5b.tar.gz
jet-bebe98b46283bf21954f5f0a4923d3add45e4d5b.zip
Add vertical movement
Diffstat (limited to 'src/client/cursor.cpp')
-rw-r--r--src/client/cursor.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/client/cursor.cpp b/src/client/cursor.cpp
index 65e32bf..82548b1 100644
--- a/src/client/cursor.cpp
+++ b/src/client/cursor.cpp
@@ -32,9 +32,21 @@ struct Cursor {
}
void move_up() {
+ if (y != 0) {
+ y--;
+ if (x > w.line_ends[y]) {
+ x = w.line_ends[y];
+ }
+ }
}
void move_down() {
+ if (element()) {
+ y++;
+ if (x > w.line_ends[y]) {
+ x = w.line_ends[y];
+ }
+ }
}
void update() {