Commit 67d1951e authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

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-d3aeb78583b8
No related merge requests found
Showing with 14 additions and 6 deletions
+14 -6
......@@ -6,9 +6,9 @@ CVS code -
do_scroll_up() and do_scroll_down(); changes to
shortcut_init(). (DLR, suggested by Mike Frysinger)
- Properly handle mouse clicks on the statusbar prompt text.
New function get_statusbar_page_start(); changes to
do_statusbar_mouse(), nanoget_repaint(), nanogetstr(), and
statusq(). (DLR)
New functions statusbar_xplustabs() and
get_statusbar_page_start(); changes to do_statusbar_mouse(),
nanoget_repaint(), nanogetstr(), and statusq(). (DLR)
- Since the statusbar prompt code needs at least 4 columns in
order to work properly, make that the minimum number of
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);
#endif
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 xplustabs(void);
size_t actual_x(const char *str, size_t xplus);
......
......@@ -1876,11 +1876,10 @@ bool do_statusbar_mouse(void)
/* Move to where the click occurred. */
if (mouse_x > start_col && mouse_y == 0) {
size_t xpt = strnlenpt(answer, statusbar_x);
statusbar_x = actual_x(answer,
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);
}
}
......@@ -2199,6 +2198,14 @@ void do_statusbar_verbatim_input(bool *got_enter)
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
* returns the column number of the first character displayed in the
* statusbar prompt when the cursor is at the given column with the
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment