mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-14 20:17:42 +00:00
Improve performance of TextStepper,
stepping line by line instead of character by character, delegating the scan for line breaks to native string search (~15-100x speedup for a full pass over typical source files)
This commit is contained in:
1 parent
97c9b8c05d
commit
d4e99dc003
2 files changed
+65
-37
No files matched your search
@@ -20,6 +20,8 @@ class TestTextUtils:
|
||||
assert lines[i][len(self.LINE) :] == ending
|
||||
|
||||
def test_line_col_from_idx(self):
|
||||
assert TextUtils.get_line_col_from_index(self.LINE, 0) == (0, 0)
|
||||
assert TextUtils.get_line_col_from_index(self.LINE, 1) == (0, 1)
|
||||
assert TextUtils.get_line_col_from_index(self.TEXT, 0) == (0, 0)
|
||||
assert TextUtils.get_line_col_from_index(self.TEXT, 1) == (0, 1)
|
||||
assert TextUtils.get_line_col_from_index(self.TEXT, 3 + 1 + 1) == (1, 1)
|
||||
|
||||
Reference in new issue
Block a user