summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pygments/lexers/_scilab_builtins.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/pygments/lexers/_scilab_builtins.py b/pygments/lexers/_scilab_builtins.py
index 456edc48..d4c02a1a 100644
--- a/pygments/lexers/_scilab_builtins.py
+++ b/pygments/lexers/_scilab_builtins.py
@@ -3064,7 +3064,7 @@ variables_kw = (
if __name__ == '__main__':
import subprocess
- from pygments.util import format_lines
+ from pygments.util import format_lines, duplicates_removed
mapping = {'variables': 'builtin'}
@@ -3077,11 +3077,18 @@ mputl(strcat(completion("", "%s"), "||"), fd);
mclose(fd)\n''' % var_type)
if '||' not in output[1]:
raise Exception(output[0])
- return output[1].strip().split('||')
+ # Invalid DISPLAY causes this to be output:
+ text = output[1].strip()
+ if text.startswith('Error: unable to open display \n'):
+ text = text[len('Error: unable to open display \n'):]
+ return text.split('||')
new_data = {}
+ seen = set() # only keep first type for a given word
for t in ('functions', 'commands', 'macros', 'variables'):
- new_data[t] = extract_completion(t)
+ new_data[t] = duplicates_removed(extract_completion(t), seen)
+ seen.update(set(new_data[t]))
+
with open(__file__) as f:
content = f.read()