commit - e9af06b91e424e5ef64da7a61c44ac01ba67349c
commit + 55df859fef332072094bb5f5e868762e5f5060c3
blob - 2a9e2350e61818e24087535ceb167bcf2cf15d05
blob + 07c02c16594531a3b18287efd383b8fc319e2399
--- ui.c
+++ ui.c
static void redraw_minibuffer(void);
static void do_redraw_echoarea(void);
static void do_redraw_minibuffer(void);
+static void place_cursor(int);
static void redraw_tab(struct tab*);
static void emit_help_item(char*, void*);
static void rec_compute_help(struct kmap*, char*, size_t);
ministate.curmesg = NULL;
redraw_minibuffer();
- if (in_minibuffer) {
- wrefresh(body);
- wrefresh(echoarea);
- } else {
- wrefresh(echoarea);
- wrefresh(body);
- }
+ place_cursor(0);
}
static void
wprintw(echoarea, " [%s]", ministate.curmesg);
wmove(echoarea, 0, off_x + utf8_swidth_between(start, c));
+}
+
+/*
+ * Place the cursor in the right ncurses window. If soft is 1, use
+ * wnoutrefresh (which shouldn't cause any I/o); otherwise use
+ * wrefresh.
+ */
+static void
+place_cursor(int soft)
+{
+ int (*touch)(WINDOW *);
+
+ if (soft)
+ touch = wnoutrefresh;
+ else
+ touch = wrefresh;
+
+ if (in_minibuffer) {
+ touch(body);
+ touch(echoarea);
+ } else {
+ touch(echoarea);
+ touch(body);
+ }
}
static void
wnoutrefresh(tabline);
wnoutrefresh(modeline);
- if (in_minibuffer) {
- wnoutrefresh(body);
- wnoutrefresh(echoarea);
- } else {
- wnoutrefresh(echoarea);
- wnoutrefresh(body);
- }
+ place_cursor(1);
doupdate();
}
}
redraw_minibuffer();
- if (in_minibuffer) {
- wrefresh(body);
- wrefresh(echoarea);
- } else {
- wrefresh(echoarea);
- wrefresh(body);
- }
+ place_cursor(0);
}
void
redraw_tabline();
wrefresh(tabline);
- if (in_minibuffer)
- wrefresh(echoarea);
- else
- wrefresh(body);
+ place_cursor(0);
}
void