Created
April 5, 2015 03:00
-
-
Save pkulchenko/9c5ce11bf6a47d0a69aa to your computer and use it in GitHub Desktop.
Fix for the dynword auto-complete crash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/editor/editor.lua b/src/editor/editor.lua | |
index 09046d3..49ce2a7 100644 | |
--- a/src/editor/editor.lua | |
+++ b/src/editor/editor.lua | |
@@ -240,7 +240,9 @@ function EditorAutoComplete(editor) | |
-- for example, if typing 'foo' in front of 'bar', 'foobar' is not offered | |
local right = linetx:sub(localpos+1,#linetx):match("^([%a_]+[%w_]*)") | |
if userList and right then | |
- userList = userList:gsub("%f[%w_]"..lt..right.."%f[%W]",""):gsub(" +"," ") | |
+ -- remove all spaces that may be left if "foo" removed from "foo foo" | |
+ userList = (userList:gsub("%f[%w_]"..lt..right.."%f[%W]","") | |
+ :gsub("^ +",""):gsub(" +$",""):gsub(" +"," ")) | |
end | |
-- don't show the list if it only suggests what's already typed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment