refactor the statusbar code to have and use statusbar_xplustabs(), for
consistency git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3063 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
3e477263da
commit
67d1951e4d
|
@ -6,9 +6,9 @@ CVS code -
|
||||||
do_scroll_up() and do_scroll_down(); changes to
|
do_scroll_up() and do_scroll_down(); changes to
|
||||||
shortcut_init(). (DLR, suggested by Mike Frysinger)
|
shortcut_init(). (DLR, suggested by Mike Frysinger)
|
||||||
- Properly handle mouse clicks on the statusbar prompt text.
|
- Properly handle mouse clicks on the statusbar prompt text.
|
||||||
New function get_statusbar_page_start(); changes to
|
New functions statusbar_xplustabs() and
|
||||||
do_statusbar_mouse(), nanoget_repaint(), nanogetstr(), and
|
get_statusbar_page_start(); changes to do_statusbar_mouse(),
|
||||||
statusq(). (DLR)
|
nanoget_repaint(), nanogetstr(), and statusq(). (DLR)
|
||||||
- Since the statusbar prompt code needs at least 4 columns in
|
- Since the statusbar prompt code needs at least 4 columns in
|
||||||
order to work properly, make that the minimum number of
|
order to work properly, make that the minimum number of
|
||||||
columns nano requires to run, and remove assertions and code
|
columns nano requires to run, and remove assertions and code
|
||||||
|
|
|
@ -632,6 +632,7 @@ bool do_statusbar_next_word(bool allow_punct);
|
||||||
bool do_statusbar_prev_word(bool allow_punct);
|
bool do_statusbar_prev_word(bool allow_punct);
|
||||||
#endif
|
#endif
|
||||||
void do_statusbar_verbatim_input(bool *got_enter);
|
void do_statusbar_verbatim_input(bool *got_enter);
|
||||||
|
size_t statusbar_xplustabs(void);
|
||||||
size_t get_statusbar_page_start(size_t start_col, size_t column);
|
size_t get_statusbar_page_start(size_t start_col, size_t column);
|
||||||
size_t xplustabs(void);
|
size_t xplustabs(void);
|
||||||
size_t actual_x(const char *str, size_t xplus);
|
size_t actual_x(const char *str, size_t xplus);
|
||||||
|
|
13
src/winio.c
13
src/winio.c
|
@ -1876,11 +1876,10 @@ bool do_statusbar_mouse(void)
|
||||||
|
|
||||||
/* 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 xpt = strnlenpt(answer, statusbar_x);
|
|
||||||
|
|
||||||
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 +
|
||||||
xpt) + mouse_x - start_col - 1);
|
statusbar_xplustabs()) + mouse_x - start_col -
|
||||||
|
1);
|
||||||
nanoget_repaint(answer, statusbar_x);
|
nanoget_repaint(answer, statusbar_x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2199,6 +2198,14 @@ void do_statusbar_verbatim_input(bool *got_enter)
|
||||||
free(output);
|
free(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return the placewewant associated with statusbar_x, i.e, the
|
||||||
|
* zero-based column position of the cursor. The value will be no
|
||||||
|
* smaller than statusbar_x. */
|
||||||
|
size_t statusbar_xplustabs(void)
|
||||||
|
{
|
||||||
|
return strnlenpt(answer, statusbar_x);
|
||||||
|
}
|
||||||
|
|
||||||
/* nano scrolls horizontally within a line in chunks. This function
|
/* nano scrolls horizontally within a line in chunks. This function
|
||||||
* returns the column number of the first character displayed in the
|
* returns the column number of the first character displayed in the
|
||||||
* statusbar prompt when the cursor is at the given column with the
|
* statusbar prompt when the cursor is at the given column with the
|
||||||
|
|
Loading…
Reference in New Issue