]> git.lizzy.rs Git - micro.git/blobdiff - runtime/plugins/autoclose/autoclose.lua
Merge branch 'python-highlight-zero' of https://github.com/a11ce/micro into a11ce...
[micro.git] / runtime / plugins / autoclose / autoclose.lua
index 05d64273c5d44dfc32d1c727fdd1cb6e9c3c914b..531b7601962d0a0881d773ccccc05587be47c30a 100644 (file)
@@ -1,3 +1,5 @@
+VERSION = "1.0.0"
+
 local uutil = import("micro/util")
 local utf8 = import("utf8")
 local autoclosePairs = {"\"\"", "''", "``", "()", "{}", "[]"}
@@ -26,7 +28,7 @@ function onRune(bp, r)
         if r == charAt(autoclosePairs[i], 1) then
             local curLine = bp.Buf:Line(bp.Cursor.Y)
 
-            if bp.Cursor.X == utf8.RuneCountInString(curLine) or not uutil.IsWordChar(charAt(curLine, bp.Cursor.X+1)) then
+            if bp.Cursor.X == uutil.CharacterCountInString(curLine) or not uutil.IsWordChar(charAt(curLine, bp.Cursor.X+1)) then
                 -- the '-' here is to derefence the pointer to bp.Cursor.Loc which is automatically made
                 -- when converting go structs to lua
                 -- It needs to be dereferenced because the function expects a non pointer struct
@@ -36,7 +38,7 @@ function onRune(bp, r)
             end
         end
     end
-    return false
+    return true
 end
 
 function preInsertNewline(bp)