From 499019c495095ecf265becbc1361548a676dc2ae Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Thu, 22 Jan 2009 16:59:00 +0100 Subject: [PATCH] Make it possible to call select_view_line for non-displayed views --- tig.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tig.c b/tig.c index 24794c6..0e1028a 100644 --- a/tig.c +++ b/tig.c @@ -2409,22 +2409,24 @@ static void search_view(struct view *view, enum request request); static void select_view_line(struct view *view, unsigned long lineno) { - assert(view_is_displayed(view)); - if (lineno - view->offset >= view->height) { view->offset = lineno; view->lineno = lineno; - redraw_view(view); + if (view_is_displayed(view)) + redraw_view(view); } else { unsigned long old_lineno = view->lineno - view->offset; view->lineno = lineno; - draw_view_line(view, old_lineno); - - draw_view_line(view, view->lineno - view->offset); - redrawwin(view->win); - wrefresh(view->win); + if (view_is_displayed(view)) { + draw_view_line(view, old_lineno); + draw_view_line(view, view->lineno - view->offset); + redrawwin(view->win); + wrefresh(view->win); + } else { + view->ops->select(view, &view->line[view->lineno]); + } } } -- 2.30.2