Skip to content

Commit

Permalink
MAVExplorer: don't show instances with dump tab completion
Browse files Browse the repository at this point in the history
Use "\\" in regex strings to avoid escape sequence warnings
Handle tab on "MSG[" without error, by changing '+' for '*' in regex
  • Loading branch information
shancock884 authored and peterbarker committed Jan 17, 2024
1 parent e67c511 commit 2d3479e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions MAVProxy/modules/lib/rline.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def complete_variable(text):
else:
suffix = ''

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

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

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

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

def rule_expand(component, text):
'''expand one rule component'''
Expand Down
2 changes: 1 addition & 1 deletion MAVProxy/tools/MAVExplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def __init__(self):
"set" : ["(SETTING)"],
"condition" : ["(VARIABLE)"],
"graph" : ['(VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE)'],
"dump" : ['(VARIABLE)'],
"dump" : ['(MESSAGETYPE)'],
"map" : ['(VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE)'],
"param" : ['download', 'check', 'help (PARAMETER)'],
}
Expand Down

0 comments on commit 2d3479e

Please sign in to comment.