summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5661324)
raw | patch | inline | side by side (parent: 5661324)
author | Kalle Wallin <kaw@linux.se> | |
Fri, 18 Jun 2004 14:21:53 +0000 (14:21 +0000) | ||
committer | Kalle Wallin <kaw@linux.se> | |
Fri, 18 Jun 2004 14:21:53 +0000 (14:21 +0000) |
src/screen_utils.c | patch | blob | history | |
src/screen_utils.h | patch | blob | history | |
src/wreadln.c | patch | blob | history | |
src/wreadln.h | patch | blob | history |
diff --git a/src/screen_utils.c b/src/screen_utils.c
index 398fdd9fea546e0664d25060d746a9ecc00631ab..16359c6eaa966aa27e3dd70200d9afc833a3ca10 100644 (file)
--- a/src/screen_utils.c
+++ b/src/screen_utils.c
return 0;
}
+void
+screen_display_completion_list(screen_t *screen, GList *list)
+{
+ WINDOW *w = screen->main_window.w;
+ gint y=0;
+ colors_use(w, COLOR_STATUS_ALERT);
+ while( y<screen->main_window.rows )
+ {
+ wmove(w, y++, 0);
+ wclrtoeol(w);
+ if( list )
+ {
+ gchar *tmp = g_strdup(list->data);
+ waddstr(w, basename(tmp));
+ g_free(tmp);
+ list = list->next;
+ }
+ }
+ wrefresh(w);
+ doupdate();
+ colors_use(w, COLOR_LIST);
+}
diff --git a/src/screen_utils.h b/src/screen_utils.h
index b6e8d11712ded8d83a5ba0bc441c64c6bae2394f..d60a33824e7eef00b964d8a51f34da254bb4b20d 100644 (file)
--- a/src/screen_utils.h
+++ b/src/screen_utils.h
+#ifndef SCREEN_UTILS_H
+#define SCREEN_UTILS_H
/* read a characher from the status window */
int screen_getch(WINDOW *w, char *prompt);
/* read a string from the status window */
char *screen_getstr(WINDOW *w, char *prompt);
+char *screen_readln(WINDOW *w, char *prompt, char *value,
+ GList **history, GCompletion *gcmp);
/* query user for a string and find it in a list window */
int screen_find(screen_t *screen,
list_window_callback_fn_t callback_fn);
-int my_waddstr(WINDOW *, const char *, int);
-int my_mvwaddstr(WINDOW *, int, int, const char *, int);
+void screen_display_completion_list(screen_t *screen, GList *list);
+
+#endif
diff --git a/src/wreadln.c b/src/wreadln.c
index 6ac94b7dc4fd39ea50dbca10e5bcc53f29ff3ebc..b5caef7dd6ef72a636ecadbb89640f2ba2147f9f 100644 (file)
--- a/src/wreadln.c
+++ b/src/wreadln.c
unsigned int wrln_max_line_size = WRLN_MAX_LINE_SIZE;
unsigned int wrln_max_history_length = WRLN_MAX_HISTORY_LENGTH;
GVoidFunc wrln_resize_callback = NULL;
+wrln_gcmp_pre_cb_t wrln_pre_completion_callback = NULL;
+wrln_gcmp_post_cb_t wrln_post_completion_callback = NULL;
char *
char *prefix = NULL;
GList *list;
- list = g_completion_complete(gcmp, line, &prefix);
+ if(wrln_pre_completion_callback)
+ wrln_pre_completion_callback(gcmp, line);
+ list = g_completion_complete(gcmp, line, &prefix);
if( prefix )
{
int len = strlen(prefix);
}
else
beep();
+ if( wrln_post_completion_callback )
+ wrln_post_completion_callback(gcmp, line, list);
}
break;
diff --git a/src/wreadln.h b/src/wreadln.h
index 270d73fb1d3e8d54084e2c882e949fded49a049a..520ba2a6a9ebfae981699db32c1e6760f6233b8a 100644 (file)
--- a/src/wreadln.h
+++ b/src/wreadln.h
/* a callback function for KEY_RESIZE */
extern GVoidFunc wrln_resize_callback;
+/* called after TAB is pressed but before g_completion_complete */
+typedef void (*wrln_gcmp_pre_cb_t) (GCompletion *gcmp, gchar *buf);
+extern wrln_gcmp_pre_cb_t wrln_pre_completion_callback;
+
+/* post completion callback */
+typedef void (*wrln_gcmp_post_cb_t) (GCompletion *gcmp, gchar *s, GList *l);
+extern wrln_gcmp_post_cb_t wrln_post_completion_callback;
+
/* Note, wreadln calls curs_set() and noecho(), to enable cursor and
* disable echo. wreadln will not restore these settings when exiting! */
char *wreadln(WINDOW *w, /* the curses window to use */