mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-24 00:35:26 +03:00
CliAutoComplete refining set
This commit is contained in:
parent
ec69becd8c
commit
e3d98220c9
1 changed files with 19 additions and 3 deletions
|
@ -307,12 +307,25 @@ CliAutoComplete._initTextcomplete = function() {
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
strategy({ // "set ="
|
||||||
|
match: /^(\s*set\s+\w*\s*)$/i,
|
||||||
|
search: function(term, callback) {
|
||||||
|
sendOnEnter = false;
|
||||||
|
searcher('', callback, ['='], false);
|
||||||
|
},
|
||||||
|
replace: function(value) {
|
||||||
|
self.openLater();
|
||||||
|
return basicReplacer(value);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
strategy({ // "set with value"
|
strategy({ // "set with value"
|
||||||
match: /^(\s*set\s+(\w+)\s*=\s*)(\w*)$/i,
|
match: /^(\s*set\s+(\w+))\s*=\s*(.*)$/i,
|
||||||
search: function(term, callback, match) {
|
search: function(term, callback, match) {
|
||||||
var arr = [];
|
var arr = [];
|
||||||
var settingName = match[2].toLowerCase();
|
var settingName = match[2].toLowerCase();
|
||||||
this.isSettingValueArray = false;
|
this.isSettingValueArray = false;
|
||||||
|
this.value = match[3];
|
||||||
sendOnEnter = !!term;
|
sendOnEnter = !!term;
|
||||||
|
|
||||||
if (settingName in cache.settingsAcceptedValues) {
|
if (settingName in cache.settingsAcceptedValues) {
|
||||||
|
@ -335,9 +348,12 @@ CliAutoComplete._initTextcomplete = function() {
|
||||||
callback(arr);
|
callback(arr);
|
||||||
},
|
},
|
||||||
replace: function (value) {
|
replace: function (value) {
|
||||||
if (this.isSettingValueArray) {
|
if (!this.isSettingValueArray) {
|
||||||
return basicReplacer(value);
|
// `value` is the tooltip text, so use the saved match
|
||||||
|
value = this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return '$1 = ' + value; // cosmetic - make sure we have spaces around the `=`
|
||||||
},
|
},
|
||||||
index: 3,
|
index: 3,
|
||||||
isSettingValueArray: false
|
isSettingValueArray: false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue