From 5803c4fc5bc306eee11ed95971829108a9f5616a Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 2 Mar 2009 17:01:00 +0000 Subject: [PATCH] Fix window choice mode, again. --- TODO | 2 -- window-choose.c | 9 ++++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index 50f21531..37d2f0d2 100644 --- a/TODO +++ b/TODO @@ -91,8 +91,6 @@ - test bug sshing from freebsd console - better support for stupid margin terminals. strcmp for cons25 sucks, how can these be autodetected? -- the escape timer for M- is too short for escape+key. fiddle with it -- page up/down in choose mode is STILL broken. damn - set-option should be set-session-option and should be overall global options for stuff like mode keys? - document status-keys diff --git a/window-choose.c b/window-choose.c index 44cec858..1d1876a6 100644 --- a/window-choose.c +++ b/window-choose.c @@ -1,4 +1,4 @@ -/* $Id: window-choose.c,v 1.12 2009-02-21 17:46:13 nicm Exp $ */ +/* $Id: window-choose.c,v 1.13 2009-03-02 17:01:00 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -237,10 +237,13 @@ window_choose_key(struct window_pane *wp, unused struct client *c, int key) if (data->selected > items - 1) data->selected = items - 1; data->top += screen_size_y(s); + if (screen_size_y(s) < items) { + if (data->top + screen_size_y(s) > items) + data->top = items - screen_size_y(s); + } else + data->top = 0; if (data->selected < data->top) data->top = data->selected; - if (data->top + screen_size_y(s) > items) - data->top = items - screen_size_y(s); window_choose_redraw_screen(wp); break; default: