X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;f=ui.c;h=874812d48430bb64a9a9fb99dee73710dc75791e;hb=a07d2a804360c52a8630ae22d7a123de13bc0d91;hp=e899be6cd463517f2aa7fe3ae4272b50a4fc7269;hpb=e34f84be19f4ff5c2ea7299ef9cfae0d450a6c24;p=pkg%2Fabook.git diff --git a/ui.c b/ui.c index e899be6..874812d 100644 --- a/ui.c +++ b/ui.c @@ -232,7 +232,7 @@ statusline_addstr(const char *str) } char * -ui_readline(char *prompt, char *s, int limit, bool use_completion) +ui_readline(char *prompt, char *s, size_t limit, bool use_completion) { int y, x; char *ret; @@ -241,7 +241,7 @@ ui_readline(char *prompt, char *s, int limit, bool use_completion) getyx(bottom, y, x); - ret = abook_readline(bottom, y, x, s, limit, use_completion); + ret = abook_readline(bottom, y, x, s, use_completion); if(ret) strtrim(ret); @@ -253,23 +253,21 @@ int statusline_ask_boolean(char *msg, int def) { int ret; - char *msg2 = strconcat(msg, def ? " (Y/n)?" : " (y/N)?", NULL); + char *msg2 = strconcat(msg, def ? _(" (Y/n)?") : _(" (y/N)?"), NULL); + char ch; statusline_addstr(msg2); free(msg2); - switch(tolower(getch())) { - case 'n': - ret = FALSE; - break; - case 'y': - ret = TRUE; - break; - default: - ret = def; - break; - } + ch = tolower(getch()); + + if(ch == *(S_("keybinding for no|n"))) + ret = FALSE; + else if(ch == *(S_("keybinding for yes|y"))) + ret = TRUE; + else + ret = def; clear_statusline(); @@ -450,7 +448,7 @@ get_commands() case 'p': ui_print_database(); break; - case 'u': launch_wwwbrowser(list_current_item()); + case 'v': launch_wwwbrowser(list_current_item()); refresh_screen(); break; } @@ -495,6 +493,7 @@ ui_find(int next) char *s; s = ui_readline("/", findstr, MAX_FIELD_LEN - 1, 0); strncpy(findstr, s, MAX_FIELD_LEN); + free(s); refresh_screen(); }