mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 13:53:10 +00:00
Stop caching the lowercase string contents in history items
This commit is contained in:
parent
92e9a34b47
commit
6b008c3eae
2 changed files with 5 additions and 4 deletions
|
@ -208,13 +208,16 @@ bool history_item_t::merge(const history_item_t &item) {
|
|||
history_item_t::history_item_t(const wcstring &str, time_t when, history_identifier_t ident)
|
||||
: creation_timestamp(when), identifier(ident) {
|
||||
contents = trim(str);
|
||||
contents_lower = wcstolower(contents);
|
||||
}
|
||||
|
||||
bool history_item_t::matches_search(const wcstring &term, enum history_search_type_t type,
|
||||
bool case_sensitive) const {
|
||||
// Note that 'term' has already been lowercased when constructing the
|
||||
// search object if we're doing a case insensitive search.
|
||||
wcstring contents_lower;
|
||||
if (!case_sensitive) {
|
||||
contents_lower = wcstolower(contents);
|
||||
}
|
||||
const wcstring &content_to_match = case_sensitive ? contents : contents_lower;
|
||||
|
||||
switch (type) {
|
||||
|
|
|
@ -69,8 +69,7 @@ class history_item_t {
|
|||
bool merge(const history_item_t &item);
|
||||
|
||||
// The actual contents of the entry.
|
||||
wcstring contents; // value as entered by the user
|
||||
wcstring contents_lower; // value normalized to all lowercase for case insensitive comparisons
|
||||
wcstring contents;
|
||||
|
||||
// Original creation time for the entry.
|
||||
time_t creation_timestamp;
|
||||
|
@ -85,7 +84,6 @@ class history_item_t {
|
|||
explicit history_item_t(const wcstring &str, time_t when = 0, history_identifier_t ident = 0);
|
||||
|
||||
const wcstring &str() const { return contents; }
|
||||
const wcstring &str_lower() const { return contents_lower; }
|
||||
|
||||
bool empty() const { return contents.empty(); }
|
||||
|
||||
|
|
Loading…
Reference in a new issue