Skip to content
This repository was archived by the owner on Jan 27, 2023. It is now read-only.

Commit 8e5faca

Browse files
correctly parse column information if it's present in the search engine results
1 parent 1433d01 commit 8e5faca

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

searchengines/base.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import subprocess
2+
import re
23

34

45
class Base:
@@ -13,6 +14,8 @@ class Base:
1314
"common_options"
1415
]
1516

17+
HAS_COLUMN_INFO = re.compile('^[^:]+:\d+:\d+:')
18+
1619
def __init__(self, settings):
1720
"""
1821
Receives the sublime.Settings object
@@ -52,7 +55,7 @@ def _sanitize_output(self, output):
5255

5356
def _parse_output(self, output):
5457
lines = output.split("\n")
55-
line_parts = [line.split(":", 2) for line in lines]
58+
line_parts = [line.split(":", 3) if Base.HAS_COLUMN_INFO.match(line) else line.split(":", 2) for line in lines]
5659
line_parts = self._filter_lines_without_matches(line_parts)
5760
return [(":".join(line[0:-1]), line[-1].strip()) for line in line_parts]
5861

0 commit comments

Comments
 (0)