diff -wur nano-cvs/src/winio.c nano-new/src/winio.c --- nano-cvs/src/winio.c 2006-04-14 18:59:44.000000000 +0200 +++ nano-new/src/winio.c 2006-04-18 16:03:14.000000000 +0200 @@ -1568,7 +1568,7 @@ * was clicked and put back the equivalent keystroke(s) for it. */ if (allow_shortcuts && !ISSET(NO_HELP) && wenclose(bottomwin, *mouse_y, *mouse_x)) { - int i, j; + int i, j, extra; size_t currslen; /* The number of shortcuts in the current shortcut list. */ const shortcut *s = currshortcut; @@ -1587,25 +1587,30 @@ currslen = MAIN_VISIBLE; } - /* Calculate the width of each shortcut in the list. It's the - * same for all of them. */ + /* Calculate the width of most of the shortcuts in the list. */ if (currslen < 2) + /* XXX Should this 6 maybe be MAIN_VISIBLE/2 ? */ i = COLS / 6; else i = COLS / ((currslen / 2) + (currslen % 2)); + /* The last two shortcuts are longer by this amount. */ + extra = COLS % i; + /* Calculate the y-coordinate relative to the beginning of * the shortcut list in bottomwin, i.e, with the sizes of * topwin, edit, and the first line of bottomwin subtracted * out. */ j = *mouse_y - (2 - no_more_space()) - editwinrows - 1; - /* If we're on the statusbar, beyond the end of the shortcut - * list, or beyond the end of a shortcut on the right side of - * the screen, don't do anything. */ - if (j < 0 || (*mouse_x / i) >= currslen) + /* If we're on the statusbar, don't do anything. */ + if (j < 0) return FALSE; j = (*mouse_x / i) * 2 + j; + /* Adjust when the mouse pointed in the extra space. */ + if ((j >= currslen) && (*mouse_x % i < extra)) + j = j - 2; + /* If we're beyond the last shortcut, don't do anything. */ if (j >= currslen) return FALSE; @@ -2205,7 +2210,7 @@ * portion of the window. */ void bottombars(const shortcut *s) { - size_t i, colwidth, slen; + size_t i, colwidth, extra, slen; if (ISSET(NO_HELP)) return; @@ -2225,6 +2230,8 @@ /* There will be this many characters per column. We need at least * 3 to display anything properly. */ colwidth = COLS / ((slen / 2) + (slen % 2)); + /* The slack at the end -- is used to run on into. */ + extra = COLS % colwidth; blank_bottombars(); @@ -2247,7 +2254,7 @@ keystr = foo; wmove(bottomwin, 1 + i % 2, (i / 2) * colwidth); - onekey(keystr, s->desc, colwidth); + onekey(keystr, s->desc, colwidth + extra); } wnoutrefresh(bottomwin);