Skip to content

Commit 2d3479e

Browse files
shancock884peterbarker
authored andcommitted
MAVExplorer: don't show instances with dump tab completion
Use "\\" in regex strings to avoid escape sequence warnings Handle tab on "MSG[" without error, by changing '+' for '*' in regex
1 parent e67c511 commit 2d3479e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

MAVProxy/modules/lib/rline.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def complete_variable(text):
189189
else:
190190
suffix = ''
191191

192-
m1 = re.match("^(.*?)([A-Z0-9][A-Z0-9_]*(\[[0-9A-Z_]+\])?)[.]([A-Za-z0-9_]*)$", text)
192+
m1 = re.match("^(.*?)([A-Z0-9][A-Z0-9_]*(\\[[0-9A-Z_]+\\])?)[.]([A-Za-z0-9_]*)$", text)
193193
if m1 is not None:
194194
prefix = m1.group(1)
195195
mtype = m1.group(2)
@@ -204,7 +204,7 @@ def complete_variable(text):
204204
return []
205205

206206
# handle partially open arrays, like 'NAMED_VALUE_FLOAT[A'
207-
m1 = re.match("^(.*?)([A-Z0-9][A-Z0-9_]*(\[[0-9A-Z_]+))$", text)
207+
m1 = re.match("^(.*?)([A-Z0-9][A-Z0-9_]*(\\[[0-9A-Z_]*))$", text)
208208
if m1 is not None:
209209
prefix = m1.group(1)
210210
mtype = m1.group(2)
@@ -215,7 +215,7 @@ def complete_variable(text):
215215
if len(ret):
216216
return ret
217217

218-
m2 = re.match("^(.*?)([A-Z0-9][A-Z0-9_]*(\[[0-9A-Z_]+\])?)$", text)
218+
m2 = re.match("^(.*?)([A-Z0-9][A-Z0-9_]*(\\[[0-9A-Z_]+\\])?)$", text)
219219
prefix = m2.group(1)
220220
mtype = m2.group(2)
221221
ret = []
@@ -237,7 +237,7 @@ def complete_messagetype(text):
237237
'''complete a MAVLink message type'''
238238
global rline_mpstate
239239

240-
return list(filter(lambda x : x.startswith(text), rline_mpstate.status.msgs.keys()))
240+
return list(filter(lambda x : x.startswith(text) and "[" not in x, rline_mpstate.status.msgs.keys()))
241241

242242
def rule_expand(component, text):
243243
'''expand one rule component'''

MAVProxy/tools/MAVExplorer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def __init__(self):
125125
"set" : ["(SETTING)"],
126126
"condition" : ["(VARIABLE)"],
127127
"graph" : ['(VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE)'],
128-
"dump" : ['(VARIABLE)'],
128+
"dump" : ['(MESSAGETYPE)'],
129129
"map" : ['(VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE)'],
130130
"param" : ['download', 'check', 'help (PARAMETER)'],
131131
}

0 commit comments

Comments
 (0)