From: Michael D. Lowis Date: Tue, 5 Jan 2016 03:41:36 +0000 (-0500) Subject: made cursor_end work with vertical scrolling X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=4a7385fdbe050ef5cdb6863a2d8070e6d5b05ef7;p=projs%2Ftide.git made cursor_end work with vertical scrolling --- diff --git a/source/main.c b/source/main.c index 7ab36b6..8f86979 100644 --- a/source/main.c +++ b/source/main.c @@ -215,16 +215,17 @@ static void cursor_down(void) static void cursor_up(void) { - Curr.y--; - if (Curr.y < 0) { - Curr.y = 0; - if (CurrFile.start->prev) { - CurrFile.start = CurrFile.start->prev; - ScreenDirty = true; + if (Loc.line->prev) { + Curr.y--; + if (Curr.y < 0) { + Curr.y = 0; + if (CurrFile.start->prev) { + CurrFile.start = CurrFile.start->prev; + ScreenDirty = true; + } } - } - if (Loc.line->prev) Loc.line = Loc.line->prev; + } } static void cursor_right(void) @@ -245,11 +246,13 @@ static void cursor_right(void) static void cursor_home(void) { Curr.x = 0; + Loc.offset = 0; ScreenDirty = true; } static void cursor_end(void) { Curr.x = ((line_length() <= 1) ? 0 : visible_length()); + Loc.offset = (line_length() > Max.x) ? line_length()-1 - Max.x : Loc.offset; ScreenDirty = true; }