From 6a45bbc048ab78f021e0dffbe27bbc6ffce50e22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Mon, 9 Nov 2015 17:35:16 +0100 Subject: view: correctly redraw window content If a change occured on the very first shown character, it was not properly reflected in the view. --- view.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'view.c') diff --git a/view.c b/view.c index 542a9e1..f984bfb 100644 --- a/view.c +++ b/view.c @@ -1105,11 +1105,14 @@ void view_cursors_to(Cursor *c, size_t pos) { view->start = pos; view_viewport_up(view, view->height / 2); } else { + /* make sure we redraw changes to the very first character of the window */ + if (view->start == pos) + view->start_last = 0; /* set the start of the viewable region to the start of the line on which * the cursor should be placed. if this line requires more space than * available in the view then simply start displaying text at the new * cursor position */ - for (int i = 0; i < 2 && (pos < view->start || pos > view->end); i++) { + for (int i = 0; i < 2 && (pos <= view->start || pos > view->end); i++) { view->start = i == 0 ? text_line_begin(view->text, pos) : pos; view_draw(view); } -- cgit v1.2.3