From 5ccf7e569f39e0e4f0774a04cec486f6208f5ab3 Mon Sep 17 00:00:00 2001 From: Mike Lowis Date: Mon, 4 Jan 2016 14:45:35 +0000 Subject: [PATCH] Fixed handling of blank lines with cursor --- source/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/main.c b/source/main.c index 11a8ba2..0c02cfc 100644 --- a/source/main.c +++ b/source/main.c @@ -165,7 +165,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)) + if (Loc.line->length <= 1) + Curr.x = 0; + else if (Curr.x >= (Loc.line->length-1 - Loc.offset)) Curr.x = (Loc.line->length-2 - Loc.offset); } -- 2.51.0