From 3694a57a24597848687b409415d4f6bf28df0bd9 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Sun, 15 Feb 2009 17:22:23 +0100 Subject: [PATCH] Fix horizontal scrolling ... to not be limited to the view width and to account for view->yoffset. --- NEWS | 1 + tig.c | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index e374662..bf68b99 100644 --- a/NEWS +++ b/NEWS @@ -23,6 +23,7 @@ Bug fixes: - Blame view: use line number information when loading blame for specific commit. - Fix handling of quoted strings in the config file. + - Fix horizontal scrolling. tig-0.14 -------- diff --git a/tig.c b/tig.c index 9c6cf01..6bf13ec 100644 --- a/tig.c +++ b/tig.c @@ -1957,14 +1957,14 @@ static bool draw_text(struct view *view, enum line_type type, const char *string, bool trim) { view->col += draw_chars(view, type, string, view->width + view->yoffset - view->col, trim); - return view->width - view->col <= 0; + return view->width + view->yoffset <= view->col; } static bool draw_graphic(struct view *view, enum line_type type, chtype graphic[], size_t size) { size_t skip = view->yoffset > view->col ? view->yoffset - view->col : 0; - int max = view->width - view->col; + int max = view->width + view->yoffset - view->col; int i; if (max < size) @@ -1981,13 +1981,13 @@ draw_graphic(struct view *view, enum line_type type, chtype graphic[], size_t si waddch(view->win, ' '); view->col++; - return view->width - view->col <= 0; + return view->width + view->yoffset <= view->col; } static bool draw_field(struct view *view, enum line_type type, const char *text, int len, bool trim) { - int max = MIN(view->width - view->col, len); + int max = MIN(view->width + view->yoffset - view->col, len); int col; if (text) @@ -2381,8 +2381,6 @@ scroll_view(struct view *view, enum request request) return; case REQ_SCROLL_RIGHT: view->yoffset += apply_step(opt_hscroll, view->width); - if (view->yoffset > view->width) - view->yoffset = view->width; redraw_view(view); report(""); return; -- 2.32.0.93.g670b81a890