From aa11ee4b0f6b186c0beca5b6bc1f818cebe981f5 Mon Sep 17 00:00:00 2001 From: Kalle Wallin Date: Wed, 15 Jun 2005 20:36:50 +0000 Subject: [PATCH] New configuraton option: find-show-last git-svn-id: https://svn.musicpd.org/ncmpc/trunk@3359 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- ChangeLog | 26 ++++++++++++++------------ doc/config.sample | 3 +++ src/conf.c | 5 +++++ src/options.h | 1 + src/screen_utils.c | 3 ++- 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index ed3e612..41df378 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2005-06-15: Kalle Wallin * Added configuraton option screen-list + * Added configuraton option find-show-last 2005-06-14: Kalle Wallin * Moved list window state code to list_window.c @@ -39,8 +40,8 @@ * Added Russian translations from Nikolay Pavlov 2004-12-19: Kalle Wallin - * Bugfixes from Niko Tyni, survive select/find operations on an empty - list + * Bugfixes from Niko Tyni, survive select/find operations on an + empty list 2004-12-12 Kalle Wallin * screen_play.c: Fixed abort (Ctrl-G) handling in the save playlist @@ -64,7 +65,7 @@ * command.c: added my_wgetch() function, Ctrl-C, Ctrl-Z are now hard coded to SIGINT and SIGSTOP * options.c: added options --mouse and --no-mouse - * Crossfade time can now be definied in the conf file (crossfade-time) + * crossfade-time can now be definied in the conf file * r1865 2004-07-12 Kalle Wallin @@ -97,7 +98,8 @@ 2004-07-02 Kalle Wallin * options.c: improved error handling in the argv parser * screen_play.c: scroll up when moving a item uppwards - * mpdclient.c: redesigned the plchanges code (its now based on qball's) + * mpdclient.c: redesigned the plchanges code (its now based on + qball's) * Added ncurses basic mouse support (playlist and browse screens) 2004-07-01 Kalle Wallin @@ -131,8 +133,8 @@ 2004-06-17 Kalle Wallin * screen_file.c: let mpd add directories (just send the path) * main.c: only set xterm title if DEBUG is defined - * mpdclient.[c|h]: added _utf8 suffix to all functions that take utf8 - arguments. + * mpdclient.[c|h]: added _utf8 suffix to all functions that take + utf8 arguments. * command.c: Support cursor/down with j and k 2004-06-17 Kalle Wallin @@ -140,14 +142,14 @@ * wreadln.c: try to complete even if the line is empty * utils.c: added type argument to gcmp_list_from_path() * screen_play.c: added completion support to handle_save_playlist() - * command.[c|h]: check_key_bindings() can now write an error messages - to a buffer instead of stderr + * command.[c|h]: check_key_bindings() can now write an error messages + to a buffer instead of stderr * main.c: display errors without exiting when key bindings are broken * screen_help.c: added the add command to the help screen 2004-06-17 Kalle Wallin - * Added a add command, used to add urls or files to the playlist, with - file completion. + * Added a add command, used to add urls or files to the playlist, + with file completion. 2004-06-16 Kalle Wallin @@ -157,7 +159,7 @@ 2004-06-16 Kalle Wallin * libmpdclient updated (r1507) * mpdclient: add path to mpdclient_cmd_db_update() - * screen_file.c: Use current path when updating the db (browse screen) + * screen_file.c: Use current path when updating the db 2004-06-15 Kalle Wallin * conf.c: Replaced '_' with '-' in configuration field names @@ -184,7 +186,7 @@ flow control characters) * command.*: Added the get_keyboard_command_with_timeout() function * main.c: Redesigned the reconnect code to allow user interrupt - * screen*: Changed arguments to the get_title callback (and the title) + * screen*: Changed title and arguments for get_title callback() * support.c: moved utility function for scrolling * list_window.c: fixed a small layout bug in list_window_paint() diff --git a/doc/config.sample b/doc/config.sample index 7be4181..3c80c2f 100644 --- a/doc/config.sample +++ b/doc/config.sample @@ -19,6 +19,9 @@ ## wrapped find mode #find-wrap = yes +## show last pattern when using find +#find-show-last = no + ## list-format #list-format = "%name%|[%artist% - ]%title%|%file%" diff --git a/src/conf.c b/src/conf.c index 73135b8..4b5e492 100644 --- a/src/conf.c +++ b/src/conf.c @@ -54,6 +54,7 @@ #define CONF_XTERM_TITLE_FORMAT "xterm-title-format" #define CONF_LIST_WRAP "wrap-around" #define CONF_FIND_WRAP "find-wrap" +#define CONF_FIND_SHOW_LAST "find-show-last" #define CONF_AUDIBLE_BELL "audible-bell" #define CONF_VISIBLE_BELL "visible-bell" #define CONF_XTERM_TITLE "set-xterm-title" @@ -490,6 +491,10 @@ read_rc_file(char *filename, options_t *options) { options->find_wrap = str2bool(value); } + else if( !strcasecmp(CONF_FIND_SHOW_LAST,name) ) + { + options->find_show_last_pattern = str2bool(value); + } else if( !strcasecmp(CONF_AUDIBLE_BELL, name) ) { options->audible_bell = str2bool(value); diff --git a/src/options.h b/src/options.h index 6acf88b..10aba14 100644 --- a/src/options.h +++ b/src/options.h @@ -21,6 +21,7 @@ typedef struct gboolean reconnect; gboolean debug; gboolean find_wrap; + gboolean find_show_last_pattern; gboolean list_wrap; gboolean auto_center; gboolean wide_cursor; diff --git a/src/screen_utils.c b/src/screen_utils.c index 09ce857..86b7792 100644 --- a/src/screen_utils.c +++ b/src/screen_utils.c @@ -116,6 +116,7 @@ screen_find(screen_t *screen, int reversed = 0; int retval = 0; char *prompt = FIND_PROMPT; + char *value = options.find_show_last_pattern ? (char *) -1 : NULL; if( findcmd==CMD_LIST_RFIND ||findcmd==CMD_LIST_RFIND_NEXT ) { @@ -138,7 +139,7 @@ screen_find(screen_t *screen, if( !screen->findbuf ) screen->findbuf=screen_readln(screen->status_window.w, prompt, - (char *) -1, //NULL, + value, &screen->find_history, NULL); if( !screen->findbuf || !screen->findbuf[0] ) -- 2.30.2