X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=ui.c;h=1d5eb4327fa2fb49687b77fac3b50eb8d0d1bb14;hb=2714c77f6d67664b2bb9fee0e2692f6542050fd9;hp=d8bcf4a6244db0b359e164a9b328dfe77cd87847;hpb=7d7ae6aab5fb6307328b7cfb193ebce3e2870624;p=pkg%2Fabook.git diff --git a/ui.c b/ui.c index d8bcf4a..1d5eb43 100644 --- a/ui.c +++ b/ui.c @@ -305,7 +305,7 @@ statusline_askchoice(const char *msg, const char *choices, short dflt) } char * -ui_readline(char *prompt, char *s, size_t limit, bool use_completion) +ui_readline(const char *prompt, char *s, size_t limit, bool use_completion) { int y, x; char *ret; @@ -326,7 +326,7 @@ ui_readline(char *prompt, char *s, size_t limit, bool use_completion) } int -statusline_ask_boolean(char *msg, int def) +statusline_ask_boolean(const char *msg, int def) { int ret; char *msg2 = strconcat(msg, def ? _(" (Y/n)?") : _(" (y/N)?"), NULL); @@ -362,7 +362,7 @@ refresh_statusline() } char * -ask_filename(char *prompt) +ask_filename(const char *prompt) { char *buf = NULL; @@ -567,9 +567,13 @@ ui_find(int next) } else { char *s; s = ui_readline("/", findstr, MAX_FIELD_LEN - 1, 0); - strncpy(findstr, s, MAX_FIELD_LEN); - free(s); refresh_screen(); + if(s == NULL) { + return; /* user cancelled (ctrl-G) */ + } else { + strncpy(findstr, s, MAX_FIELD_LEN); + free(s); + } } if( (item = find_item(findstr, list_get_curitem() + !!next,