---
left.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/left.c b/left.c
index ee8a29d..f50cfb1 100644
--- a/left.c
+++ b/left.c
@@ -149,7 +149,7 @@ getcell(int x, int y)
} else
col++;
}
- return 0;
+ return -1;
}
int
@@ -334,8 +334,9 @@ setscroll(int v)
void
setselection(int from, int to)
{
- sel.from = clamp(from, 0, doc.len);
- sel.to = to < from ? from : clamp(to, 0, doc.len);
+ if(from == -1) return;
+ sel.from = clamp(from, 0, doc.len - 1);
+ sel.to = to < from ? from : clamp(to, 0, doc.len - 1);
if(getrow(sel.to) - sel.scroll > VER - 1)
setscroll(getrow(sel.to) - VER + 1);
if(getrow(sel.from) - sel.scroll < 0)
--
2.29.2