From 6f801ae17628193cd2d666137a11710939e82794 Mon Sep 17 00:00:00 2001 From: Kalle Wallin Date: Tue, 28 Mar 2006 07:43:51 +0000 Subject: =?UTF-8?q?fixed=20TAB=20completion=20support=20with=20libcursesw?= =?UTF-8?q?=20(path=20from=20Ren=C3=A9=20van=20Bevern)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.musicpd.org/ncmpc/trunk@3957 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/wreadln.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/wreadln.c') 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); -- cgit v1.2.3