mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-31 23:28:45 +00:00
Revert "use std::tolower"
This reverts commit a3db4128bc
.
This broke the build.
This commit is contained in:
parent
a3db4128bc
commit
91c4dad812
5 changed files with 16 additions and 6 deletions
|
@ -633,7 +633,7 @@ class wildcard_matcher_t : public string_matcher_t {
|
||||||
io_streams_t &streams)
|
io_streams_t &streams)
|
||||||
: string_matcher_t(opts, streams), wcpattern(parse_util_unescape_wildcards(pattern)) {
|
: string_matcher_t(opts, streams), wcpattern(parse_util_unescape_wildcards(pattern)) {
|
||||||
if (opts.ignore_case) {
|
if (opts.ignore_case) {
|
||||||
wcpattern = std::tolower(std::move(wcpattern));
|
wcpattern = wcstolower(std::move(wcpattern));
|
||||||
}
|
}
|
||||||
if (opts.entire) {
|
if (opts.entire) {
|
||||||
if (!wcpattern.empty()) {
|
if (!wcpattern.empty()) {
|
||||||
|
@ -654,7 +654,7 @@ class wildcard_matcher_t : public string_matcher_t {
|
||||||
bool match;
|
bool match;
|
||||||
|
|
||||||
if (opts.ignore_case) {
|
if (opts.ignore_case) {
|
||||||
match = wildcard_match(std::tolower(arg), wcpattern, false);
|
match = wildcard_match(wcstolower(arg), wcpattern, false);
|
||||||
} else {
|
} else {
|
||||||
match = wildcard_match(arg, wcpattern, false);
|
match = wildcard_match(arg, wcpattern, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,9 +79,9 @@ enum : wchar_t {
|
||||||
VARIABLE_EXPAND,
|
VARIABLE_EXPAND,
|
||||||
/// Character representing variable expansion into a single element.
|
/// Character representing variable expansion into a single element.
|
||||||
VARIABLE_EXPAND_SINGLE,
|
VARIABLE_EXPAND_SINGLE,
|
||||||
/// Character representing the start of a brace expansion.
|
/// Character representing the start of a bracket expansion.
|
||||||
BRACE_BEGIN,
|
BRACE_BEGIN,
|
||||||
/// Character representing the end of a brace expansion.
|
/// Character representing the end of a bracket expansion.
|
||||||
BRACE_END,
|
BRACE_END,
|
||||||
/// Character representing separation between two bracket elements.
|
/// Character representing separation between two bracket elements.
|
||||||
BRACE_SEP,
|
BRACE_SEP,
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <cwchar>
|
#include <cwchar>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <locale>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
@ -181,7 +180,7 @@ bool history_item_t::matches_search(const wcstring &term, enum history_search_ty
|
||||||
// search object if we're doing a case insensitive search.
|
// search object if we're doing a case insensitive search.
|
||||||
wcstring contents_lower;
|
wcstring contents_lower;
|
||||||
if (!case_sensitive) {
|
if (!case_sensitive) {
|
||||||
contents_lower = std::tolower(contents);
|
contents_lower = wcstolower(contents);
|
||||||
}
|
}
|
||||||
const wcstring &content_to_match = case_sensitive ? contents : contents_lower;
|
const wcstring &content_to_match = case_sensitive ? contents : contents_lower;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "wcstringutil.h"
|
#include "wcstringutil.h"
|
||||||
|
|
||||||
|
#include <wctype.h>
|
||||||
|
|
||||||
typedef wcstring::size_type size_type;
|
typedef wcstring::size_type size_type;
|
||||||
|
|
||||||
wcstring_range wcstring_tok(wcstring &str, const wcstring &needle, wcstring_range last) {
|
wcstring_range wcstring_tok(wcstring &str, const wcstring &needle, wcstring_range last) {
|
||||||
|
@ -62,3 +64,9 @@ wcstring trim(wcstring input, const wchar_t *any_of) {
|
||||||
result.erase(0, prefix);
|
result.erase(0, prefix);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wcstring wcstolower(wcstring input) {
|
||||||
|
wcstring result = std::move(input);
|
||||||
|
std::transform(result.begin(), result.end(), result.begin(), towlower);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
|
@ -68,4 +68,7 @@ wcstring truncate(const wcstring &input, int max_len,
|
||||||
wcstring trim(wcstring input);
|
wcstring trim(wcstring input);
|
||||||
wcstring trim(wcstring input, const wchar_t *any_of);
|
wcstring trim(wcstring input, const wchar_t *any_of);
|
||||||
|
|
||||||
|
/// Converts a string to lowercase.
|
||||||
|
wcstring wcstolower(wcstring input);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue