mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 05:43:11 +00:00
input: Use range-for
Also adds a couple of consts.
This commit is contained in:
parent
51cc03ca75
commit
5a9d153363
1 changed files with 4 additions and 10 deletions
|
@ -227,8 +227,7 @@ void input_mapping_add(const wchar_t *sequence, const wchar_t *const *commands,
|
||||||
|
|
||||||
auto& ml = user ? mapping_list : preset_mapping_list;
|
auto& ml = user ? mapping_list : preset_mapping_list;
|
||||||
|
|
||||||
for (size_t i = 0; i < ml.size(); i++) {
|
for (input_mapping_t& m : ml) {
|
||||||
input_mapping_t &m = ml.at(i);
|
|
||||||
if (m.seq == sequence && m.mode == mode) {
|
if (m.seq == sequence && m.mode == mode) {
|
||||||
m.commands = commands_vector;
|
m.commands = commands_vector;
|
||||||
m.sets_mode = sets_mode;
|
m.sets_mode = sets_mode;
|
||||||
|
@ -744,8 +743,7 @@ bool input_terminfo_get_sequence(const wchar_t *name, wcstring *out_seq) {
|
||||||
const char *res = 0;
|
const char *res = 0;
|
||||||
int err = ENOENT;
|
int err = ENOENT;
|
||||||
|
|
||||||
for (size_t i = 0; i < terminfo_mappings.size(); i++) {
|
for (const terminfo_mapping_t &m : terminfo_mappings) {
|
||||||
const terminfo_mapping_t &m = terminfo_mappings.at(i);
|
|
||||||
if (!std::wcscmp(name, m.name)) {
|
if (!std::wcscmp(name, m.name)) {
|
||||||
res = m.seq;
|
res = m.seq;
|
||||||
err = EILSEQ;
|
err = EILSEQ;
|
||||||
|
@ -765,9 +763,7 @@ bool input_terminfo_get_sequence(const wchar_t *name, wcstring *out_seq) {
|
||||||
bool input_terminfo_get_name(const wcstring &seq, wcstring *out_name) {
|
bool input_terminfo_get_name(const wcstring &seq, wcstring *out_name) {
|
||||||
assert(input_initialized);
|
assert(input_initialized);
|
||||||
|
|
||||||
for (size_t i = 0; i < terminfo_mappings.size(); i++) {
|
for (const terminfo_mapping_t &m : terminfo_mappings) {
|
||||||
terminfo_mapping_t &m = terminfo_mappings.at(i);
|
|
||||||
|
|
||||||
if (!m.seq) {
|
if (!m.seq) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -787,9 +783,7 @@ wcstring_list_t input_terminfo_get_names(bool skip_null) {
|
||||||
wcstring_list_t result;
|
wcstring_list_t result;
|
||||||
result.reserve(terminfo_mappings.size());
|
result.reserve(terminfo_mappings.size());
|
||||||
|
|
||||||
for (size_t i = 0; i < terminfo_mappings.size(); i++) {
|
for (const terminfo_mapping_t &m : terminfo_mappings) {
|
||||||
terminfo_mapping_t &m = terminfo_mappings.at(i);
|
|
||||||
|
|
||||||
if (skip_null && !m.seq) {
|
if (skip_null && !m.seq) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue