2 * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 * Ncurses UI for telescope.
23 * ncurses allows you to scroll a window, but when a line goes out of
24 * the visible area it's forgotten. We keep a list of formatted lines
25 * (``visual lines'') that we know fits in the window, and draw them.
27 * This means that on every resize we have to clear our list of lines
28 * and re-render everything. A clever approach would be to do this
29 * ``on-demand'', but it's still missing.
46 #include "minibuffer.h"
47 #include "telescope.h"
51 static struct event stdioev, winchev;
53 static void restore_curs_x(struct buffer *);
55 static int readkey(void);
56 static void dispatch_stdio(int, short, void*);
57 static void handle_resize(int, short, void*);
58 static void handle_resize_nodelay(int, short, void*);
59 static void rearrange_windows(void);
60 static void line_prefix_and_text(struct vline *, char *, size_t, const char **, const char **);
61 static void print_vline(int, int, WINDOW*, struct vline*);
62 static void redraw_tabline(void);
63 static void redraw_window(WINDOW*, int, int, int, struct buffer*);
64 static void redraw_help(void);
65 static void redraw_body(struct tab*);
66 static void redraw_modeline(struct tab*);
67 static void redraw_minibuffer(void);
68 static void do_redraw_echoarea(void);
69 static void do_redraw_minibuffer(void);
70 static void do_redraw_minibuffer_compl(void);
71 static void place_cursor(int);
72 static void redraw_tab(struct tab*);
73 static void update_loading_anim(int, short, void*);
74 static void stop_loading_anim(struct tab*);
77 * Used to know when we're finished loading.
81 static int should_rearrange_windows;
85 struct thiskey thiskey;
86 struct tab *current_tab;
88 static struct event resizeev;
89 static struct timeval resize_timer = { 0, 250000 };
91 static WINDOW *tabline, *body, *modeline, *echoarea, *minibuffer;
93 int body_lines, body_cols;
96 /* not static so we can see them from help.c */
97 struct buffer helpwin;
98 int help_lines, help_cols;
100 static int side_window;
101 static int in_side_window;
103 static struct timeval loadingev_timer = { 0, 250000 };
105 static uint32_t tab_counter;
107 static char keybuf[64];
109 struct kmap global_map,
115 update_x_offset(void)
117 if (olivetti_mode && fill_column < body_cols)
118 x_offset = (body_cols - fill_column)/2;
124 save_excursion(struct excursion *place, struct buffer *buffer)
126 place->curs_x = buffer->curs_x;
127 place->curs_y = buffer->curs_y;
128 place->line_off = buffer->line_off;
129 place->top_line = buffer->top_line;
130 place->current_line = buffer->current_line;
131 place->cpoff = buffer->cpoff;
135 restore_excursion(struct excursion *place, struct buffer *buffer)
137 buffer->curs_x = place->curs_x;
138 buffer->curs_y = place->curs_y;
139 buffer->line_off = place->line_off;
140 buffer->top_line = place->top_line;
141 buffer->current_line = place->current_line;
142 buffer->cpoff = place->cpoff;
146 restore_curs_x(struct buffer *buffer)
149 const char *prfx, *text;
151 vl = buffer->current_line;
152 if (vl == NULL || vl->line == NULL)
153 buffer->curs_x = buffer->cpoff = 0;
154 else if (vl->parent->data != NULL) {
155 text = vl->parent->data;
156 buffer->curs_x = utf8_snwidth(text + 1, buffer->cpoff) + 1;
158 buffer->curs_x = utf8_snwidth(vl->line, buffer->cpoff);
160 buffer->curs_x += x_offset;
165 if (vl->parent->data != NULL)
166 buffer->curs_x += utf8_swidth_between(vl->parent->line, vl->parent->data);
168 prfx = line_prefixes[vl->parent->type].prfx1;
169 buffer->curs_x += utf8_swidth(prfx);
174 global_key_unbound(void)
176 message("%s is undefined", keybuf);
183 return &ministate.buffer;
186 return ¤t_tab->buffer;
194 if ((thiskey.key = wgetch(body)) == ERR)
197 thiskey.meta = thiskey.key == 27;
199 thiskey.key = wgetch(body);
200 if (thiskey.key == ERR || thiskey.key == 27) {
207 if ((unsigned int)thiskey.key < UINT8_MAX) {
209 if (!utf8_decode(&state, &thiskey.cp, (uint8_t)thiskey.key))
211 if ((thiskey.key = wgetch(body)) == ERR) {
212 message("Error decoding user input");
222 dispatch_stdio(int fd, short ev, void *d)
228 /* TODO: schedule a redraw? */
235 if (keybuf[0] != '\0')
236 strlcat(keybuf, " ", sizeof(keybuf));
238 strlcat(keybuf, "M-", sizeof(keybuf));
239 if (thiskey.cp != 0) {
240 utf8_encode(thiskey.cp, tmp);
241 strlcat(keybuf, tmp, sizeof(keybuf));
242 } else if ((keyname = unkbd(thiskey.key)) != NULL) {
243 strlcat(keybuf, keyname, sizeof(keybuf));
245 tmp[0] = thiskey.key;
246 strlcat(keybuf, tmp, sizeof(keybuf));
249 TAILQ_FOREACH(k, ¤t_map->m, keymaps) {
250 if (k->meta == thiskey.meta &&
251 k->key == thiskey.key) {
253 current_map = &k->map;
255 current_map = base_map;
256 strlcpy(keybuf, "", sizeof(keybuf));
257 k->fn(current_buffer());
263 if (current_map->unhandled_input != NULL)
264 current_map->unhandled_input();
266 global_key_unbound();
268 strlcpy(keybuf, "", sizeof(keybuf));
269 current_map = base_map;
275 if (should_rearrange_windows)
277 redraw_tab(current_tab);
281 handle_resize(int sig, short ev, void *d)
283 if (event_pending(&resizeev, EV_TIMEOUT, NULL)) {
284 event_del(&resizeev);
286 evtimer_set(&resizeev, handle_resize_nodelay, NULL);
287 evtimer_add(&resizeev, &resize_timer);
291 handle_resize_nodelay(int s, short ev, void *d)
301 rearrange_windows(void)
305 should_rearrange_windows = 0;
309 if ((too_small = lines < 15)) {
311 printw("Window too small.");
316 /* move and resize the windows, in reverse order! */
318 if (in_minibuffer == MB_COMPREAD) {
319 mvwin(minibuffer, lines-10, 0);
320 wresize(minibuffer, 10, COLS);
323 wrap_page(&ministate.compl.buffer, COLS);
326 mvwin(echoarea, --lines, 0);
327 wresize(echoarea, 1, COLS);
329 mvwin(modeline, --lines, 0);
330 wresize(modeline, 1, COLS);
332 body_lines = --lines;
336 help_cols = 0.3 * COLS;
339 wresize(help, help_lines, help_cols);
341 wrap_page(&helpwin, help_cols);
343 body_cols = COLS - help_cols - 1;
344 mvwin(body, 1, help_cols);
349 wresize(body, body_lines, body_cols);
351 wresize(tabline, 1, COLS);
353 wrap_page(¤t_tab->buffer, body_cols);
354 redraw_tab(current_tab);
358 line_prefix_and_text(struct vline *vl, char *buf, size_t len,
359 const char **prfx_ret, const char **text_ret)
361 int type, i, cont, width;
364 if ((*text_ret = vl->line) == NULL)
367 cont = vl->flags & L_CONTINUATION;
368 type = vl->parent->type;
370 *prfx_ret = line_prefixes[type].prfx1;
372 *prfx_ret = line_prefixes[type].prfx2;
374 space = vl->parent->data;
375 if (!emojify_link || type != LINE_LINK || space == NULL)
380 width = utf8_swidth_between(vl->parent->line, space);
381 for (i = 0; i < width + 1; ++i)
382 strlcat(buf, " ", len);
384 strlcpy(buf, *text_ret, len);
385 if ((t = strchr(buf, ' ')) != NULL)
387 strlcat(buf, " ", len);
390 *text_ret += (space - vl->parent->line) + 1;
397 print_vline_descr(int width, WINDOW *window, struct vline *vl)
401 if (vl->parent->type != LINE_COMPL &&
402 vl->parent->type != LINE_COMPL_CURRENT)
405 if (vl->parent->alt == NULL)
413 wprintw(window, " ");
414 for (; goal > x; ++x)
415 wprintw(window, " ");
417 wprintw(window, "%s", vl->parent->alt);
421 * Core part of the rendering. It prints a vline starting from the
422 * current cursor position. Printing a vline consists of skipping
423 * `off' columns (for olivetti-mode), print the correct prefix (which
424 * may be the emoji in case of emojified links-lines), printing the
425 * text itself, filling until width - off and filling off columns
429 print_vline(int off, int width, WINDOW *window, struct vline *vl)
432 * Believe me or not, I've seen emoji ten code points long!
433 * That means, to stay large, 4*10 bytes + NUL.
435 char emojibuf[41] = {0};
436 const char *text, *prfx;
440 f = &line_faces[vl->parent->type];
442 /* unused, set by getyx */
445 line_prefix_and_text(vl, emojibuf, sizeof(emojibuf), &prfx, &text);
447 wattr_on(window, body_face.left, NULL);
448 for (i = 0; i < off; i++)
450 wattr_off(window, body_face.left, NULL);
452 wattr_on(window, f->prefix, NULL);
453 wprintw(window, "%s", prfx);
454 wattr_off(window, f->prefix, NULL);
456 wattr_on(window, f->text, NULL);
457 wprintw(window, "%s", text);
458 print_vline_descr(width, window, vl);
459 wattr_off(window, f->text, NULL);
465 wattr_on(window, f->trail, NULL);
466 for (i = 0; i < left - off; ++i)
468 wattr_off(window, f->trail, NULL);
470 wattr_on(window, body_face.right, NULL);
471 for (i = 0; i < off; i++)
473 wattr_off(window, body_face.right, NULL);
481 size_t toskip, ots, tabwidth, space, x;
482 int current, y, truncated, pair;
488 /* unused, but setted by a getyx */
491 tabwidth = sizeof(buf)+1;
495 TAILQ_FOREACH(tab, &tabshead, tabs) {
497 if (tab == current_tab)
501 if (toskip * tabwidth < space)
506 while (toskip != 0 &&
507 (ots - toskip+1) * tabwidth < space)
512 wattr_on(tabline, tab_face.background, NULL);
513 wprintw(tabline, toskip == 0 ? " " : "<");
514 wattr_off(tabline, tab_face.background, NULL);
517 TAILQ_FOREACH(tab, &tabshead, tabs) {
525 getyx(tabline, y, x);
526 if (x + sizeof(buf)+2 >= (size_t)COLS)
529 current = tab == current_tab;
531 if (*(title = tab->buffer.page.title) == '\0')
532 title = tab->hist_cur->h;
534 if (tab->flags & TAB_URGENT)
535 strlcpy(buf, "!", sizeof(buf));
537 strlcpy(buf, " ", sizeof(buf));
539 if (strlcat(buf, title, sizeof(buf)) >= sizeof(buf)) {
540 /* truncation happens */
541 strlcpy(&buf[sizeof(buf)-4], "...", 4);
543 /* pad with spaces */
544 while (strlcat(buf, " ", sizeof(buf)) < sizeof(buf))
548 pair = current ? tab_face.current : tab_face.tab;
549 wattr_on(tabline, pair, NULL);
550 wprintw(tabline, "%s", buf);
551 wattr_off(tabline, pair, NULL);
553 wattr_on(tabline, tab_face.background, NULL);
554 if (TAILQ_NEXT(tab, tabs) != NULL)
555 wprintw(tabline, "│");
556 wattr_off(tabline, tab_face.background, NULL);
559 wattr_on(tabline, tab_face.background, NULL);
560 for (; x < (size_t)COLS; ++x)
561 waddch(tabline, ' ');
563 mvwprintw(tabline, 0, COLS-1, ">");
564 wattr_off(tabline, tab_face.background, NULL);
568 * Compute the first visible line around vl. Try to search forward
569 * until the end of the buffer; if a visible line is not found, search
570 * backward. Return NULL if no viable line was found.
573 adjust_line(struct vline *vl, struct buffer *buffer)
580 if (!(vl->parent->flags & L_HIDDEN))
585 t != NULL && t->parent->flags & L_HIDDEN;
586 t = TAILQ_NEXT(t, vlines))
592 /* search backward */
594 t != NULL && t->parent->flags & L_HIDDEN;
595 t = TAILQ_PREV(t, vhead, vlines))
602 redraw_window(WINDOW *win, int off, int height, int width, struct buffer *buffer)
607 restore_curs_x(buffer);
610 * TODO: ignoring buffer->force_update and always
611 * re-rendering. In theory we can recompute the y position
612 * without a re-render, and optimize here. It's not the only
613 * optimisation possible here, wscrl wolud also be an
621 if (TAILQ_EMPTY(&buffer->head))
624 if (buffer->top_line == NULL)
625 buffer->top_line = TAILQ_FIRST(&buffer->head);
627 buffer->top_line = adjust_line(buffer->top_line, buffer);
628 if (buffer->top_line == NULL)
631 buffer->current_line = adjust_line(buffer->current_line, buffer);
635 for (vl = buffer->top_line; vl != NULL; vl = TAILQ_NEXT(vl, vlines)) {
636 if (vl->parent->flags & L_HIDDEN)
640 print_vline(off, width, win, vl);
642 if (vl == buffer->current_line)
654 for (; vl != NULL; vl = TAILQ_NEXT(vl, vlines)) {
655 if (vl == buffer->current_line)
657 if (vl->parent->flags & L_HIDDEN)
660 buffer->top_line = TAILQ_NEXT(buffer->top_line, vlines);
667 buffer->last_line_off = buffer->line_off;
668 buffer->force_redraw = 0;
670 wmove(win, buffer->curs_y, buffer->curs_x);
676 redraw_window(help, 0, help_lines, help_cols, &helpwin);
680 redraw_body(struct tab *tab)
682 static struct tab *last_tab;
685 tab->buffer.force_redraw =1;
688 redraw_window(body, x_offset, body_lines, body_cols, &tab->buffer);
692 trust_status_char(enum trust_state ts)
695 case TS_UNKNOWN: return '-';
696 case TS_UNTRUSTED: return '!';
697 case TS_TEMP_TRUSTED: return '!';
698 case TS_TRUSTED: return 'v';
699 case TS_VERIFIED: return 'V';
705 redraw_modeline(struct tab *tab)
707 struct buffer *buffer;
709 int x, y, max_x, max_y;
711 const char *spin = "-\\|/";
713 buffer = current_buffer();
714 mode = buffer->page.name;
717 wattr_on(modeline, modeline_face.background, NULL);
718 wmove(modeline, 0, 0);
720 wprintw(modeline, "-%c%c %s ",
721 spin[tab->loading_anim_step],
722 trust_status_char(tab->trust),
723 mode == NULL ? "(none)" : mode);
725 pct = (buffer->line_off + buffer->curs_y) * 100.0
728 if (buffer->line_max <= (size_t)body_lines)
729 wprintw(modeline, "All ");
730 else if (buffer->line_off == 0)
731 wprintw(modeline, "Top ");
732 else if (buffer->line_off + body_lines >= buffer->line_max)
733 wprintw(modeline, "Bottom ");
735 wprintw(modeline, "%.0f%% ", pct);
737 wprintw(modeline, "%d/%d %s ",
738 buffer->line_off + buffer->curs_y,
742 getyx(modeline, y, x);
743 getmaxyx(modeline, max_y, max_x);
748 for (; x < max_x; ++x)
749 waddstr(modeline, "-");
751 wattr_off(modeline, modeline_face.background, NULL);
755 redraw_minibuffer(void)
757 wattr_on(echoarea, minibuffer_face.background, NULL);
761 do_redraw_minibuffer();
763 do_redraw_echoarea();
765 if (in_minibuffer == MB_COMPREAD)
766 do_redraw_minibuffer_compl();
768 wattr_off(echoarea, minibuffer_face.background, NULL);
772 do_redraw_echoarea(void)
776 if (ministate.curmesg != NULL)
777 wprintw(echoarea, "%s", ministate.curmesg);
778 else if (*keybuf != '\0')
779 waddstr(echoarea, keybuf);
781 /* If nothing else, show the URL at point */
782 vl = current_tab->buffer.current_line;
783 if (vl != NULL && vl->parent->type == LINE_LINK)
784 waddstr(echoarea, vl->parent->alt);
789 do_redraw_minibuffer(void)
791 size_t off_y, off_x = 0;
792 const char *start, *c;
794 /* unused, set by getyx */
797 wmove(echoarea, 0, 0);
799 if (in_minibuffer == MB_COMPREAD)
800 wprintw(echoarea, "(%2d) ",
801 ministate.compl.buffer.line_max);
803 wprintw(echoarea, "%s", ministate.prompt);
804 if (ministate.hist_cur != NULL)
805 wprintw(echoarea, "(%zu/%zu) ",
806 ministate.hist_off + 1,
807 ministate.history->len);
809 getyx(echoarea, off_y, off_x);
811 start = ministate.hist_cur != NULL
812 ? ministate.hist_cur->h
814 c = utf8_nth(ministate.buffer.current_line->line,
815 ministate.buffer.cpoff);
816 while (utf8_swidth_between(start, c) > (size_t)COLS/2) {
817 start = utf8_next_cp(start);
820 waddstr(echoarea, start);
822 if (ministate.curmesg != NULL)
823 wprintw(echoarea, " [%s]", ministate.curmesg);
825 wmove(echoarea, 0, off_x + utf8_swidth_between(start, c));
829 do_redraw_minibuffer_compl(void)
831 redraw_window(minibuffer, 0, 10, body_cols,
832 &ministate.compl.buffer);
836 * Place the cursor in the right ncurses window. If soft is 1, use
837 * wnoutrefresh (which shouldn't cause any I/O); otherwise use
841 place_cursor(int soft)
843 int (*touch)(WINDOW *);
846 touch = wnoutrefresh;
855 } else if (in_side_window) {
868 redraw_tab(struct tab *tab)
880 redraw_modeline(tab);
883 wnoutrefresh(tabline);
884 wnoutrefresh(modeline);
886 if (in_minibuffer == MB_COMPREAD)
887 wnoutrefresh(minibuffer);
894 dprintf(1, "\033]0;%s - Telescope\a",
895 current_tab->buffer.page.title);
899 start_loading_anim(struct tab *tab)
901 if (tab->loading_anim)
903 tab->loading_anim = 1;
904 evtimer_set(&tab->loadingev, update_loading_anim, tab);
905 evtimer_add(&tab->loadingev, &loadingev_timer);
909 update_loading_anim(int fd, short ev, void *d)
913 tab->loading_anim_step = (tab->loading_anim_step+1)%4;
915 if (tab == current_tab) {
916 redraw_modeline(tab);
923 evtimer_add(&tab->loadingev, &loadingev_timer);
927 stop_loading_anim(struct tab *tab)
929 if (!tab->loading_anim)
931 evtimer_del(&tab->loadingev);
932 tab->loading_anim = 0;
933 tab->loading_anim_step = 0;
935 if (tab != current_tab)
938 redraw_modeline(tab);
947 load_url_in_tab(struct tab *tab, const char *url, const char *base)
950 load_url(tab, url, base);
954 message("Loading %s...", url);
955 start_loading_anim(tab);
956 load_url(tab, url, base);
962 switch_to_tab(struct tab *tab)
965 tab->flags &= ~TAB_URGENT;
967 if (operating && tab->flags & TAB_LAZY)
968 load_url_in_tab(tab, tab->hist_cur->h, NULL);
974 return tab_counter++;
978 new_tab(const char *url, const char *base)
982 if ((tab = calloc(1, sizeof(*tab))) == NULL) {
988 TAILQ_INIT(&tab->hist.head);
990 TAILQ_INIT(&tab->buffer.head);
992 tab->id = tab_new_id();
994 tab->flags |= TAB_LAZY;
997 if (TAILQ_EMPTY(&tabshead))
998 TAILQ_INSERT_HEAD(&tabshead, tab, tabs);
1000 TAILQ_INSERT_TAIL(&tabshead, tab, tabs);
1002 load_url_in_tab(tab, url, base);
1007 ui_print_colors(void)
1009 int colors = 0, pairs = 0, can_change = 0;
1010 int columns = 16, lines, color, i, j;
1015 use_default_colors();
1018 pairs = COLOR_PAIRS;
1019 can_change = can_change_color();
1023 printf("Term info:\n");
1024 printf("TERM=%s COLORS=%d COLOR_PAIRS=%d can_change_colors=%d\n",
1025 getenv("TERM"), colors, pairs, can_change);
1029 printf("No color support\n");
1033 printf("Available colors:\n\n");
1034 lines = (colors - 1) / columns + 1;
1036 for (i = 0; i < lines; ++i) {
1037 for (j = 0; j < columns; ++j, ++color) {
1038 printf("\033[0;38;5;%dm %03d", color, color);
1051 setlocale(LC_ALL, "");
1055 /* initialize help window */
1056 TAILQ_INIT(&helpwin.head);
1058 base_map = &global_map;
1059 current_map = &global_map;
1063 if (enable_colors) {
1066 use_default_colors();
1071 config_apply_style();
1076 intrflush(stdscr, FALSE);
1078 if ((tabline = newwin(1, COLS, 0, 0)) == NULL)
1080 if ((body = newwin(LINES - 3, COLS, 1, 0)) == NULL)
1082 if ((modeline = newwin(1, COLS, LINES-2, 0)) == NULL)
1084 if ((echoarea = newwin(1, COLS, LINES-1, 0)) == NULL)
1086 if ((minibuffer = newwin(1, COLS, LINES-1, 0)) == NULL)
1088 if ((help = newwin(1, 1, 1, 0)) == NULL)
1091 body_lines = LINES-3;
1094 wbkgd(body, body_face.body);
1095 wbkgd(echoarea, minibuffer_face.background);
1100 scrollok(body, FALSE);
1102 /* non-blocking input */
1106 mvwprintw(body, 0, 0, "");
1108 evtimer_set(&resizeev, handle_resize, NULL);
1110 event_set(&stdioev, 0, EV_READ | EV_PERSIST, dispatch_stdio, NULL);
1111 event_add(&stdioev, NULL);
1113 signal_set(&winchev, SIGWINCH, handle_resize, NULL);
1114 signal_add(&winchev, NULL);
1123 switch_to_tab(current_tab);
1124 redraw_tab(current_tab);
1130 ui_on_tab_loaded(struct tab *tab)
1132 stop_loading_anim(tab);
1133 message("Loaded %s", tab->hist_cur->h);
1141 ui_on_tab_refresh(struct tab *tab)
1143 wrap_page(&tab->buffer, body_cols);
1144 if (tab == current_tab)
1147 tab->flags |= TAB_URGENT;
1157 ui_toggle_side_window(void)
1159 side_window = !side_window;
1166 * ugly hack, but otherwise the window doesn't get updated
1167 * until I call rearrange_windows a second time (e.g. via
1168 * C-l). I will be happy to know why something like this is
1171 rearrange_windows();
1172 rearrange_windows();
1176 ui_schedule_redraw(void)
1178 should_rearrange_windows = 1;
1182 ui_require_input(struct tab *tab, int hide)
1184 /* TODO: hard-switching to another tab is ugly */
1187 enter_minibuffer(ir_self_insert, ir_select, exit_minibuffer,
1188 &ir_history, NULL, NULL);
1189 strlcpy(ministate.prompt, "Input required: ",
1190 sizeof(ministate.prompt));
1195 ui_after_message_hook(void)
1197 redraw_minibuffer();
1202 ui_yornp(const char *prompt, void (*fn)(int, struct tab *),
1205 yornp(prompt, fn, data);
1206 redraw_tab(current_tab);
1210 ui_read(const char *prompt, void (*fn)(const char*, struct tab *),
1213 minibuffer_read(prompt, fn, data);
1214 redraw_tab(current_tab);
1218 ui_other_window(void)
1221 in_side_window = !in_side_window;
1223 message("No other window to select");
1231 kill(getpid(), SIGSTOP);
1235 rearrange_windows();