Skip to content

Commit

Permalink
add ability to filter by item notes (#35617)
Browse files Browse the repository at this point in the history
* add ability to search through filter by item notes with n:
  • Loading branch information
jagoly authored and ZhilkinSerg committed Nov 25, 2019
1 parent 4db2957 commit 8cc6f3d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/item_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ std::function<bool( const item & )> basic_item_filter( std::string filter )
}
return false;
};
// item notes
case 'n':
return [filter]( const item & i ) {
const std::string note = i.get_var( "item_note" );
return !note.empty() && lcmatch( note, filter );
};
// by name
default:
return [filter]( const item & a ) {
Expand Down
4 changes: 2 additions & 2 deletions src/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,10 +732,10 @@ void draw_item_filter_rules( const catacurses::window &win, int starty, int heig
}

starty += fold_and_print( win, point( 1, starty ), len, c_white,
_( "Search [c]ategory, [m]aterial, [q]uality or [d]isassembled components:" ) );
_( "Search [c]ategory, [m]aterial, [q]uality, [n]otes or [d]isassembled components:" ) );
fold_and_print( win, point( 1, starty ), len, c_white,
//~ An example of how to filter items based on category or material.
_( "Examples: c:food,m:iron,q:hammering,d:pipe" ) );
_( "Examples: c:food,m:iron,q:hammering,n:toolshelf,d:pipe" ) );
wrefresh( win );
}

Expand Down

0 comments on commit 8cc6f3d

Please sign in to comment.