aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalle Wallin <kaw@linux.se>2006-03-28 07:43:51 +0000
committerKalle Wallin <kaw@linux.se>2006-03-28 07:43:51 +0000
commit6f801ae17628193cd2d666137a11710939e82794 (patch)
tree1ca8dea1f2036c0a46d361182f842e0431c756e3
parent7391a6e7fada2ad1814ec637cfc1b0094a7b4cdb (diff)
downloadmpd-6f801ae17628193cd2d666137a11710939e82794.tar.gz
mpd-6f801ae17628193cd2d666137a11710939e82794.tar.xz
mpd-6f801ae17628193cd2d666137a11710939e82794.zip
fixed TAB completion support with libcursesw (path from René van Bevern)
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@3957 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--ChangeLog4
-rw-r--r--src/wreadln.c27
2 files changed, 31 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index bc21a2d03..62a9af590 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-03-28 Kalle Wallin <kaw@linux.se>
+ * wreadln.c: fixed TAB completion support when built with libcursesw
+ (path from René van Bevern)
+
2006-01-22 Kalle Wallin <kaw@linux.se>
* configure.ac: use libcursesw by default
* wreadln.c: use wget_wch (wide characters) when built with libcursesw
diff --git a/src/wreadln.c b/src/wreadln.c
index d5c25cc8b..fac2080c2 100644
--- a/src/wreadln.c
+++ b/src/wreadln.c
@@ -586,6 +586,33 @@ wreadln(WINDOW *w,
case KEY_CTRL_E:
cursor_move_to_eol();
break;
+ case TAB:
+ if( gcmp )
+ {
+ char *prefix = NULL;
+ GList *list;
+
+ i = wcstombs(NULL,wline,0)+1;
+ mbline = g_malloc0(i);
+ wcstombs(mbline, wline, i);
+
+ if(wrln_pre_completion_callback)
+ wrln_pre_completion_callback(gcmp, mbline);
+ list = g_completion_complete(gcmp, mbline, &prefix);
+ if( prefix )
+ {
+ mbstowcs(wline, prefix, wrln_max_line_size);
+ cursor_move_to_eol();
+ g_free(prefix);
+ }
+ else
+ screen_bell();
+ if( wrln_post_completion_callback )
+ wrln_post_completion_callback(gcmp, mbline, list);
+
+ g_free(mbline);
+ }
+ break;
case KEY_CTRL_G:
screen_bell();
g_free(wline);