fix minor display and cursor placement problems when scrolling between

pages at the statusbar prompt


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4189 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2007-12-08 07:00:27 +00:00
parent cd79a81692
commit 281a469442
2 changed files with 14 additions and 8 deletions

View File

@ -1,3 +1,10 @@
2007-12-08 David Lawrence Ramsey <pooka109@gmail.com>
* prompt.c (do_statusbar_mouse, reset_statusbar_cursor,
update_statusbar_line, need_statusbar_horizontal_update): Fix
minor display and cursor placement problems when scrolling
between pages at the statusbar prompt.
2007-12-07 David Lawrence Ramsey <pooka109@gmail.com> 2007-12-07 David Lawrence Ramsey <pooka109@gmail.com>
* winio.c (get_mouseinput): Fix longstanding problem where mouse * winio.c (get_mouseinput): Fix longstanding problem where mouse

View File

@ -285,16 +285,15 @@ int do_statusbar_mouse(void)
assert(prompt != NULL); assert(prompt != NULL);
start_col = strlenpt(prompt) + 1; start_col = strlenpt(prompt) + 2;
/* Move to where the click occurred. */ /* Move to where the click occurred. */
if (mouse_x > start_col && mouse_y == 0) { if (mouse_x >= start_col && mouse_y == 0) {
size_t pww_save = statusbar_pww; size_t pww_save = statusbar_pww;
statusbar_x = actual_x(answer, statusbar_x = actual_x(answer,
get_statusbar_page_start(start_col, start_col + get_statusbar_page_start(start_col, start_col +
statusbar_xplustabs()) + mouse_x - statusbar_xplustabs()) + mouse_x - start_col);
start_col - 1);
statusbar_pww = statusbar_xplustabs(); statusbar_pww = statusbar_xplustabs();
if (need_statusbar_horizontal_update(pww_save)) if (need_statusbar_horizontal_update(pww_save))
@ -865,10 +864,10 @@ size_t get_statusbar_page_start(size_t start_col, size_t column)
/* Put the cursor in the statusbar prompt at statusbar_x. */ /* Put the cursor in the statusbar prompt at statusbar_x. */
void reset_statusbar_cursor(void) void reset_statusbar_cursor(void)
{ {
size_t start_col = strlenpt(prompt) + 1; size_t start_col = strlenpt(prompt) + 2;
size_t xpt = statusbar_xplustabs(); size_t xpt = statusbar_xplustabs();
wmove(bottomwin, 0, start_col + 1 + xpt - wmove(bottomwin, 0, start_col + xpt -
get_statusbar_page_start(start_col, start_col + xpt)); get_statusbar_page_start(start_col, start_col + xpt));
} }
@ -882,7 +881,7 @@ void update_statusbar_line(const char *curranswer, size_t index)
assert(prompt != NULL && index <= strlen(curranswer)); assert(prompt != NULL && index <= strlen(curranswer));
start_col = strlenpt(prompt) + 1; start_col = strlenpt(prompt) + 2;
index = strnlenpt(curranswer, index); index = strnlenpt(curranswer, index);
page_start = get_statusbar_page_start(start_col, start_col + index); page_start = get_statusbar_page_start(start_col, start_col + index);
@ -910,7 +909,7 @@ void update_statusbar_line(const char *curranswer, size_t index)
* different pages. */ * different pages. */
bool need_statusbar_horizontal_update(size_t pww_save) bool need_statusbar_horizontal_update(size_t pww_save)
{ {
size_t start_col = strlenpt(prompt) + 1; size_t start_col = strlenpt(prompt) + 2;
return get_statusbar_page_start(start_col, start_col + pww_save) != return get_statusbar_page_start(start_col, start_col + pww_save) !=
get_statusbar_page_start(start_col, start_col + statusbar_pww); get_statusbar_page_start(start_col, start_col + statusbar_pww);