From: Mike Lowis Date: Mon, 4 Jan 2016 14:31:38 +0000 (+0000) Subject: Cap cursor at end of visible text of current line X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=4417820b6119d515e3ae70d924f33212a1d8a59c;p=projs%2Ftide.git Cap cursor at end of visible text of current line --- diff --git a/source/main.c b/source/main.c index d9ba650..11a8ba2 100644 --- a/source/main.c +++ b/source/main.c @@ -134,6 +134,8 @@ static void input(int ch) ScreenDirty = true; } } + if (Loc.line->next) + Loc.line = Loc.line->next; break; case KEY_UP: @@ -146,6 +148,8 @@ static void input(int ch) ScreenDirty = true; } } + if (Loc.line->prev) + Loc.line = Loc.line->prev; break; case KEY_RIGHT: @@ -160,6 +164,9 @@ static void input(int ch) } break; } + /* Cap the column selection at the end of text on the current line */ + if (Curr.x >= (Loc.line->length-1 - Loc.offset)) + Curr.x = (Loc.line->length-2 - Loc.offset); } static void edit(void)