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
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);
/* 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);
}
}
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