diff options
author | 2011-02-28 19:49:02 -0500 | |
---|---|---|
committer | 2011-02-28 19:49:02 -0500 | |
commit | 9bc5512ce503bc153b4a84feb697b67b37450369 (patch) | |
tree | f57df8e2f51ea0b228ca89acead5a67764ea519a | |
parent | f9d6db0ad834b1fe0c5d84893274d9bba98b9134 (diff) | |
download | textadept-9bc5512ce503bc153b4a84feb697b67b37450369.tar.gz textadept-9bc5512ce503bc153b4a84feb697b67b37450369.zip |
Fixed infinite loop error in select_scope(); modules/textadept/editing.lua
-rw-r--r-- | modules/textadept/editing.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua index ee8e3d70..a24347df 100644 --- a/modules/textadept/editing.lua +++ b/modules/textadept/editing.lua @@ -404,13 +404,13 @@ end -- Selects all text with the same style as under the caret. function select_scope() local buffer = buffer - local start_pos = buffer.current_pos - local base_style = buffer.style_at[start_pos] + local start_pos, length = buffer.current_pos, buffer.length + local base_style, style_at = buffer.style_at[start_pos], buffer.style_at local pos = start_pos - 1 - while buffer.style_at[pos] == base_style do pos = pos - 1 end + while pos >= 0 and style_at[pos] == base_style do pos = pos - 1 end local start_style = pos pos = start_pos + 1 - while buffer.style_at[pos] == base_style do pos = pos + 1 end + while pos < length and style_at[pos] == base_style do pos = pos + 1 end buffer:set_sel(start_style + 1, pos) end |