From bebe98b46283bf21954f5f0a4923d3add45e4d5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Tom=C3=A1s?= Date: Wed, 5 Aug 2020 20:09:25 -0300 Subject: Add vertical movement --- src/client/cursor.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/client/cursor.cpp') 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() { -- cgit v1.2.3