file browser.c; changes to striponedir(), browser_init(),
do_browser(), and do_browse_from() (all moved to browser.c).
(DLR)
+ - Add the statusbar prompt's equivalent of placewewant,
+ statusbar_pww, to prompt.c, and convert (most of) its
+ functions to use it. Changes to do_statusbar_mouse(),
+ do_statusbar_output(), do_statusbar_home(),
+ do_statusbar_end(), do_statusbar_right(), do_statusbar_left(),
+ do_statusbar_delete(), do_statusbar_cut_text(),
+ do_statusbar_next_word(), do_statusbar_prev_word(),
+ do_statusbar_verbatim_input(), and nanogetstr(). (DLR)
- files.c:
read_file()
- Remove apparently unneeded logic to handle a case where
* questions. */
static size_t statusbar_x = (size_t)-1;
/* The cursor position in answer. */
+static size_t statusbar_pww = (size_t)-1;
+ /* The place we want in answer. */
static bool reset_statusbar_x = FALSE;
/* Should we reset the cursor position
* at the statusbar prompt? */
get_statusbar_page_start(start_col, start_col +
statusbar_xplustabs()) + mouse_x - start_col -
1);
- nanoget_repaint(answer, statusbar_x);
+ statusbar_pww = statusbar_xplustabs();
+ /*nanoget_repaint(answer, statusbar_x);*/
}
}
}
}
free(char_buf);
+
+ statusbar_pww = statusbar_xplustabs();
+
+ /*nanoget_repaint(answer, statusbar_x);*/
}
void do_statusbar_home(void)
if (statusbar_x == statusbar_x_save ||
statusbar_x == strlen(answer))
statusbar_x = 0;
- } else
+
+ statusbar_pww = statusbar_xplustabs();
+ } else {
#endif
statusbar_x = 0;
+ statusbar_pww = statusbar_xplustabs();
+#ifndef NANO_SMALL
+ }
+#endif
+
+ /*nanoget_repaint(answer, statusbar_x);*/
}
void do_statusbar_end(void)
{
statusbar_x = strlen(answer);
+ statusbar_pww = statusbar_xplustabs();
+
+ /*nanoget_repaint(answer, statusbar_x);*/
}
void do_statusbar_right(void)
{
- if (statusbar_x < strlen(answer))
+ if (statusbar_x < strlen(answer)) {
statusbar_x = move_mbright(answer, statusbar_x);
+ statusbar_pww = statusbar_xplustabs();
+
+ /*nanoget_repaint(answer, statusbar_x);*/
+ }
}
void do_statusbar_left(void)
{
- if (statusbar_x > 0)
+ if (statusbar_x > 0) {
statusbar_x = move_mbleft(answer, statusbar_x);
+ statusbar_pww = statusbar_xplustabs();
+
+ /*nanoget_repaint(answer, statusbar_x);*/
+ }
}
void do_statusbar_backspace(void)
void do_statusbar_delete(void)
{
+ statusbar_pww = statusbar_xplustabs();
+
if (answer[statusbar_x] != '\0') {
int char_buf_len = parse_mbchar(answer + statusbar_x, NULL,
NULL);
#endif
null_at(&answer, 0);
statusbar_x = 0;
+ statusbar_pww = statusbar_xplustabs();
#ifndef NANO_SMALL
}
#endif
+
+ /*nanoget_repaint(answer, statusbar_x);*/
}
#ifndef NANO_SMALL
free(char_mb);
+ statusbar_pww = statusbar_xplustabs();
+
+ /*nanoget_repaint(answer, statusbar_x);*/
+
/* Return whether we started on a word. */
return started_on_word;
}
free(char_mb);
+ statusbar_pww = statusbar_xplustabs();
+
+ /*nanoget_repaint(answer, statusbar_x);*/
+
/* Return whether we started on a word. */
return started_on_word;
}
answer = mallocstrcpy(answer, curranswer);
curranswer_len = strlen(answer);
- /* Only put statusbar_x at the end of the string if it's
- * uninitialized, if it would be past the end of curranswer, or if
- * reset_statusbar_x is TRUE. Otherwise, leave it alone. This is
- * so the cursor position stays at the same place if a
- * prompt-changing toggle is pressed. */
+ /* Only put statusbar_x at the end of the string (and change
+ * statusbar_pww to match) if it's uninitialized, if it would be
+ * past the end of curranswer, or if reset_statusbar_x is TRUE.
+ * Otherwise, leave it alone. This is so the cursor position stays
+ * at the same place if a prompt-changing toggle is pressed. */
if (statusbar_x == (size_t)-1 || statusbar_x > curranswer_len ||
- reset_statusbar_x)
+ reset_statusbar_x) {
statusbar_x = curranswer_len;
+ statusbar_pww = statusbar_xplustabs();
+ }
currshortcut = s;
#endif
/* We finished putting in an answer or ran a normal shortcut's
- * associated function, so reset statusbar_x. */
+ * associated function, so reset statusbar_x and statusbar_pww. */
if (kbinput == NANO_CANCEL_KEY || kbinput == NANO_ENTER_KEY ||
- ran_func)
+ ran_func) {
statusbar_x = (size_t)-1;
+ statusbar_pww = (size_t)-1;
+ }
return kbinput;
}