diff --git a/src/screen_utils.c b/src/screen_utils.c
index 6473244bbce7534dcbe4281ca51ee381e3e7d333..baa371be1aec79ae12c1ece3bd4691b1cb995869 100644 (file)
--- a/src/screen_utils.c
+++ b/src/screen_utils.c
#define FIND_PROMPT _("Find: ")
#define RFIND_PROMPT _("Find backward: ")
+void
+screen_bell(void)
+{
+ if( options.audible_bell )
+ beep();
+ if( options.visible_bell )
+ flash();
+}
+
int
screen_getch(WINDOW *w, char *prompt)
{
curs_set(1);
timeout(-1);
- while( (key=wgetch(w)) == ERR )
+ while( (key=my_wgetch(w)) == ERR )
;
-
- if( key==KEY_RESIZE )
- screen_resize();
+
+#ifdef HAVE_GETMOUSE
+ /* ignore mouse events */
+ if( key==KEY_MOUSE )
+ return screen_getch(w, prompt);
+#endif
noecho();
curs_set(0);
wmove(w, 0,0);
curs_set(1);
+ colors_use(w, COLOR_STATUS_ALERT);
line = wreadln(w, prompt, value, COLS, history, gcmp);
curs_set(0);
return line;
else
{
screen_status_printf(_("Unable to find \'%s\'"), screen->findbuf);
- beep();
+ screen_bell();
}
return 1;
default:
return 0;
}
+void
+screen_display_completion_list(screen_t *screen, GList *list)
+{
+ static GList *prev_list = NULL;
+ static gint prev_length = 0;
+ static gint offset = 0;
+ WINDOW *w = screen->main_window.w;
+ gint length, y=0;
+
+ length = g_list_length(list);
+ if( list==prev_list && length==prev_length )
+ {
+ offset += screen->main_window.rows;
+ if( offset>=length )
+ offset=0;
+ }
+ else
+ {
+ prev_list = list;
+ prev_length = length;
+ offset = 0;
+ }
+
+ colors_use(w, COLOR_STATUS_ALERT);
+ while( y<screen->main_window.rows )
+ {
+ GList *item = g_list_nth(list, y+offset);
+ wmove(w, y++, 0);
+ wclrtoeol(w);
+ if( item )
+ {
+ gchar *tmp = g_strdup(item->data);
+ waddstr(w, basename(tmp));
+ g_free(tmp);
+ }
+ }
+ wrefresh(w);
+ doupdate();
+ colors_use(w, COLOR_LIST);
+}
+
+void
+set_xterm_title(char *format, ...)
+{
+ /* the current xterm title exists under the WM_NAME property */
+ /* and can be retreived with xprop -id $WINDOWID */
+
+ if( options.enable_xterm_title )
+ {
+ if( g_getenv("WINDOWID") )
+ {
+ char *msg;
+ va_list ap;
+
+ va_start(ap,format);
+ msg = g_strdup_vprintf(format,ap);
+ va_end(ap);
+ printf("%c]0;%s%c", '\033', msg, '\007');
+ g_free(msg);
+ }
+ else
+ options.enable_xterm_title = FALSE;
+ }
+}