[awesome-menu] Fix a problem with XK_Tab completion and with "." listing

This commit is contained in:
Julien Danjou 2008-03-10 11:00:38 +01:00
parent f3652aaca6
commit 8db08ea43e
1 changed files with 9 additions and 6 deletions

View File

@ -236,7 +236,9 @@ item_list_fill_file(const char *directory)
item_list_wipe(&globalconf.items); item_list_wipe(&globalconf.items);
if(a_strlen(directory) > 1 && directory[0] == '~') if(!directory)
a_strcpy(cwd, sizeof(cwd), "./");
else if(a_strlen(directory) > 1 && directory[0] == '~')
{ {
if(directory[1] == '/') if(directory[1] == '/')
{ {
@ -265,7 +267,7 @@ item_list_fill_file(const char *directory)
} }
} }
else else
a_strcpy(cwd, sizeof(cwd), "."); a_strcpy(cwd, sizeof(cwd), directory);
if(!(dir = opendir(cwd))) if(!(dir = opendir(cwd)))
return False; return False;
@ -533,9 +535,12 @@ handle_kpress(XKeyEvent *e)
{ {
default: default:
if(num && !iscntrl((int) buf[0])) if(num && !iscntrl((int) buf[0]))
{
if(buf[0] != '/' || globalconf.text[len - 1] != '/')
{ {
buf[num] = '\0'; buf[num] = '\0';
a_strncat(globalconf.text, sizeof(globalconf.text), buf, num); a_strncat(globalconf.text, sizeof(globalconf.text), buf, num);
}
compute_match(get_last_word(globalconf.text)); compute_match(get_last_word(globalconf.text));
redraw(); redraw();
} }
@ -551,13 +556,11 @@ handle_kpress(XKeyEvent *e)
case XK_ISO_Left_Tab: case XK_ISO_Left_Tab:
case XK_Left: case XK_Left:
complete(True); complete(True);
compute_match(get_last_word(globalconf.text));
redraw(); redraw();
break; break;
case XK_Right: case XK_Right:
case XK_Tab: case XK_Tab:
complete(False); complete(False);
compute_match(get_last_word(globalconf.text));
redraw(); redraw();
break; break;
case XK_Escape: case XK_Escape: