]> git.lizzy.rs Git - micro.git/commitdiff
Expose CharacterCount to plugins
authorZachary Yedidia <zyedidia@gmail.com>
Wed, 20 May 2020 22:04:00 +0000 (18:04 -0400)
committerZachary Yedidia <zyedidia@gmail.com>
Wed, 20 May 2020 22:04:00 +0000 (18:04 -0400)
cmd/micro/initlua.go
internal/config/runtime.go
runtime/plugins/autoclose/autoclose.lua

index 01aee38481df6a58903fe2aa63ddb02041e68382..6658d6d25608d58a641a6cba59765b98d5b40397 100644 (file)
@@ -141,6 +141,7 @@ func luaImportMicroUtil() *lua.LTable {
        ulua.L.SetField(pkg, "GetLeadingWhitespace", luar.New(ulua.L, util.LuaGetLeadingWhitespace))
        ulua.L.SetField(pkg, "IsWordChar", luar.New(ulua.L, util.LuaIsWordChar))
        ulua.L.SetField(pkg, "String", luar.New(ulua.L, util.String))
+       ulua.L.SetField(pkg, "CharacterCountInString", luar.New(ulua.L, util.CharacterCountInString))
        ulua.L.SetField(pkg, "RuneStr", luar.New(ulua.L, func(r rune) string {
                return string(r)
        }))
index 56afdba7a5caf12c17ca5b3927faa21250a1ef57..b2dba0769378998e63f26d8e6ef2eb1a3a98b56e 100644 (file)
@@ -1063,7 +1063,7 @@ func runtimeHelpTutorialMd() (*asset, error) {
        return a, nil
 }
 
-var _runtimePluginsAutocloseAutocloseLua = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x55\x51\x6b\xdb\x30\x10\x7e\xcf\xaf\x38\xbc\x87\xd8\x34\xf6\xea\x3d\x8d\x82\x07\x6b\x37\x46\x20\xb4\xa3\x1d\xeb\x46\x5b\xa8\x2c\x9f\x62\x51\x47\x32\x67\x69\xe9\x28\xfd\xef\x43\x76\x92\xda\x99\xeb\x24\x50\x3f\x28\xb1\x75\x9f\xee\xee\xbb\xef\x4e\x3f\xbf\x5e\x5e\x4d\x2f\xce\x21\x01\x2f\x8e\x8e\xa3\x63\x6f\x34\x2a\x34\x67\x05\x58\x6b\x64\x01\x09\xc8\x45\xa9\xc9\xf8\xde\x42\x72\xd2\xef\xdd\x47\x2f\x58\x9b\x18\xf1\xb1\x65\xe1\x5e\x37\x7b\xcc\x1a\xcd\x0b\x5d\xe1\x77\x26\xa9\x82\x04\x9e\xbc\x5b\xef\xd6\xf3\x26\xe0\x8d\xc7\x6e\xbd\xbf\x77\xab\x1f\xb8\xf5\xe9\xd9\xad\x37\x77\xde\x73\x0b\x7d\x8e\xcb\x42\xaa\x16\xfe\x3f\xdb\x91\xb0\x8a\x1b\xa9\x15\xf0\x9c\xd1\x67\xe3\x57\x86\x26\x20\x83\x11\x00\x40\x18\x42\x61\x19\x48\x95\xe1\xa3\x54\x73\x90\x15\x68\x85\xa0\x85\x00\x41\x7a\x01\x73\x5d\x9b\x11\x1a\x4b\xaa\xc9\x36\xba\xb4\x0a\x37\xc7\x84\x71\x30\x42\x95\xb5\xbc\x68\xe5\x0c\xfc\xb4\x9c\x00\x35\x4e\x84\x26\x90\x90\x40\x3c\x81\x77\x5b\x19\x67\xcd\xf9\xee\x91\x02\x08\x92\x64\x1d\x65\xd7\xf0\x46\xde\x4d\xe0\x43\x00\x26\x47\xb5\x41\xb8\xa7\x61\x82\x5b\x9a\x49\x85\x90\x40\x5a\x46\xa7\x56\x9c\xb8\x37\x3f\x2d\xa3\x33\x4b\x95\xa6\xe8\x77\x30\xea\xa0\xa4\x58\xbb\x59\x21\x27\xf0\x62\xfc\xeb\x28\x0e\x0e\x0f\xc4\x3d\x69\x79\x72\xca\xf8\x43\x55\x32\x8e\x7e\xd0\xb7\xdd\xb8\xb8\x94\xf3\xdc\xf4\x19\x10\xb2\x87\xce\xd7\x9a\xda\xad\xc8\x5b\x91\xc2\x27\x88\x81\xa9\x0c\xfc\xa6\x34\xd3\xea\x5a\x53\x76\x96\x33\xf2\x07\xf2\x0b\xe3\x20\x00\x4d\x43\x14\x84\xbb\x28\x70\x47\xf4\x73\xd0\x9b\x43\xdf\xff\xdd\x05\x8f\xdf\xb2\xe0\x6d\xda\x92\xa4\x6e\xcb\x5a\xca\x67\xda\x2a\x33\x55\x57\x86\xa4\x9a\xaf\xc9\xa8\xf9\x51\xda\xc0\x21\xbc\x1e\xbd\x4a\x4a\x18\xba\xef\x30\x0e\xc7\x90\x23\xa1\x6b\x33\xa3\x21\x43\x42\x81\x8a\x63\xbd\x59\x6a\xa9\x0c\x92\xdb\x78\x39\x73\xa6\x39\x2c\x73\xc9\x73\x07\x71\x0c\x2d\x98\x91\x9c\x15\xc5\x5f\x58\xb0\x0c\xfb\x1c\x2d\x73\x54\xc0\xb5\xfa\x83\x64\x5c\x4b\xcf\x35\x54\x86\x2c\x37\xb5\xcf\xc2\xb2\x3e\xd0\xd4\x80\x42\xcc\x6a\x93\x14\x57\x91\x91\x8b\x2d\x83\x14\x39\xb3\x55\x13\xe4\xa6\xcb\xf1\xb1\x44\x77\x24\x03\xa5\xd5\x26\xf6\xc6\x51\x8f\xf0\xeb\x1a\x4d\x55\x85\x64\xfc\xb0\x93\xde\x64\xb0\xcf\x06\x9a\x68\x86\x62\xff\x1e\xda\xfe\xbf\xfe\x5d\x0d\x36\x43\x16\xb7\xc6\x58\x49\xd8\xc4\xbb\x9a\xb0\x7e\x5a\x36\xce\xf6\x16\x60\xc7\xd8\x29\x0d\x92\xa1\x96\x6b\x03\x14\x3e\x9a\xdd\x88\xa3\xb8\x8d\x59\xba\xf9\xdf\xc8\xf5\x1b\x9a\x19\xb2\x4c\xaa\xf9\x75\x2e\x0d\x36\xf3\x68\xad\xec\x51\xef\x4c\xee\xdc\x23\xdd\xa9\xbc\x89\xbe\xd3\xaa\x6d\xc0\xab\xcd\x2a\x45\x2b\x95\x61\xf8\xc0\x4c\xed\xd6\xa1\x57\x12\x8d\xc9\x0f\x96\xf6\x6e\x0f\xa9\xcf\xbb\x55\x1e\x44\x11\x2c\xab\xde\x83\xaf\x0c\x23\x73\x21\x66\xaf\x7a\x1e\x14\xe3\x4a\x5e\x82\x15\x15\xee\xa5\xc9\xdd\xa2\x7c\xb9\x60\xd6\x82\xdc\xef\x7a\x3d\x48\xb6\xf0\x26\x77\xa4\xbb\x98\x86\x04\x7f\xf8\xf0\x4f\xcb\x93\x2f\x58\xa0\x69\xd7\x62\x27\x7d\xff\x02\x00\x00\xff\xff\x6b\xa0\x51\x0f\xbd\x09\x00\x00"
+var _runtimePluginsAutocloseAutocloseLua = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x55\x51\x6b\xe3\x38\x10\x7e\xcf\xaf\x18\x7c\x0f\xb1\x69\xec\xab\xef\xe9\x28\xf8\xe0\xda\x3b\x96\x40\x68\x97\x76\xd9\xee\xd2\x16\x2a\xcb\xe3\x58\xd4\x91\xcc\x78\xb4\xe9\x52\xfa\xdf\x17\xc5\x49\x6a\x67\x5d\x27\x81\xfa\x41\x89\xad\xf9\x34\xa3\x6f\xbe\x99\xf9\xfa\xff\xf5\xcd\xf4\xea\x12\x12\xf0\xe2\xe8\x34\x3a\xf5\x46\xa3\xd2\x48\x51\x82\xb5\xac\x4a\x48\x40\x2d\x2a\x43\xec\x7b\x0b\x25\xc9\xfc\xe9\x3e\x7a\xc1\xc6\x84\xf3\xbf\x5b\x16\xee\x75\xbb\x27\x2c\x1b\x59\x9a\x1a\x3f\x0b\x45\x35\x24\xf0\xe2\xdd\x7b\xf7\x9e\x37\x01\x6f\x3c\x76\xeb\xe3\xa3\x5b\xfd\xc0\xad\x2f\xaf\x6e\xbd\x7b\xf0\x5e\x5b\xe8\x4b\x5c\x96\x4a\xb7\xf0\xbf\xd9\x8e\x72\xab\x25\x2b\xa3\x41\x16\x82\xfe\x65\xbf\x66\x9a\x80\x0a\x46\x00\x00\x61\x08\xa5\x15\xa0\x74\x86\xcf\x4a\xcf\x41\xd5\x60\x34\x82\xc9\x73\xc8\xc9\x2c\x60\x6e\x56\x66\x84\x6c\x49\x37\xb7\x8d\xae\xad\xc6\xed\x31\x61\x1c\x8c\x50\x67\x2d\x2f\x46\x3b\x03\x3f\xad\x26\x40\x8d\x93\xdc\x10\x28\x48\x20\x9e\xc0\x1f\x3b\x37\xce\x9a\xf3\xdd\xa3\x72\x20\x48\x92\x4d\x94\x5d\xc3\x3b\xf5\x30\x81\xbf\x02\xe0\x02\xf5\x16\xe1\x9e\x86\x09\x69\x69\xa6\x34\x42\x02\x69\x15\x9d\xdb\xfc\xcc\xbd\xf9\x69\x15\x5d\x58\xaa\x0d\x45\xdf\x83\x51\x07\xa5\xf2\x8d\x9b\x35\x72\x02\x6f\xc6\xdf\x4e\xe2\xe0\xf8\x40\xdc\x93\x56\x67\xe7\x42\x3e\xd5\x95\x90\xe8\x07\x7d\xdb\x8d\x8b\x6b\x35\x2f\xb8\xcf\x80\x50\x3c\x75\xbe\xae\xa8\xdd\x89\xbc\x15\x29\xfc\x03\x31\x08\x9d\x81\xdf\xa4\x66\x5a\xdf\x1a\xca\x2e\x0a\x41\xfe\xc0\xfd\xc2\x38\x08\xc0\xd0\x10\x05\xe1\x3e\x0a\xdc\x11\xfd\x1c\xf4\xde\xa1\xef\xff\xfe\x84\xc7\x1f\x99\xf0\x36\x6d\x49\xb2\xd6\xb2\xa3\x4a\x48\x46\xba\x30\x56\xf3\x54\xdf\x30\x29\x3d\xdf\x50\xb2\x62\x49\x1b\x86\x63\xd8\x3d\x79\x97\x9a\x30\x74\xdf\x61\x1c\x8e\xa1\x40\x42\x57\x6c\x6c\x20\x43\xc2\x1c\xb5\xc4\xd5\x66\x65\x94\x66\x24\xb7\xf1\x76\xe6\xcc\x48\x58\x16\x4a\x16\x0e\xe2\x78\x5a\x08\x56\x52\x94\xe5\x4f\x58\x88\x0c\xfb\x1c\x2d\x0b\xd4\x20\x8d\xfe\x81\xc4\xae\xb0\xe7\x06\x6a\x26\x2b\x79\xe5\xb3\xb4\xa2\x0f\x34\x65\xd0\x88\xd9\xca\x24\xc5\x75\x64\xe4\x62\xcb\x20\x45\x29\x6c\xdd\x04\xb9\xad\x75\x7c\xae\xd0\x1d\x29\x40\x1b\xbd\x8d\xbd\x71\xd4\x23\xff\x55\xa6\xa6\xba\x46\x62\x3f\xec\x5c\x6f\x32\x58\x6d\x03\xa5\x34\xc3\xfc\xf0\x4a\xda\xfd\xbf\xf9\x5d\xb7\x37\x26\x8b\x3b\xcd\xac\x22\x6c\xe2\x5d\xf7\x59\x3f\xad\x1a\x67\x07\xcb\xb0\x63\xec\x3a\x23\x24\x43\x85\xd7\x06\x68\x7c\xe6\xfd\x88\x93\xb8\x8d\x59\xba\x29\xd0\xc8\xf5\x13\xf2\x0c\x45\xa6\xf4\xfc\xb6\x50\x8c\x4d\x57\xda\x28\x7b\xd4\xdb\x99\x3b\xd3\xa4\xdb\x9b\xb7\xd1\x77\x0a\xb6\x0d\x78\xb7\x64\x55\xde\xba\xca\x30\x7c\xa0\xb3\x76\xf3\xd0\x2b\x89\xc6\xe4\x8b\x48\x7b\xb7\x87\xd4\xe7\xdd\x6b\x0f\xa2\x08\x96\x75\xef\xc1\x37\x2c\x88\xaf\xf2\xd9\xbb\x9e\x07\xc5\xb8\x96\x57\x2e\xca\x1a\x0f\xd2\xe4\x7e\x51\xbe\x8d\x99\x8d\x20\x0f\x1b\xb2\x47\xc9\x16\x3e\x64\x52\xba\xf1\x34\x24\xf8\xe3\x47\x40\x5a\x9d\xfd\x87\x25\x72\x3b\x17\x7b\xe9\xfb\x15\x00\x00\xff\xff\x58\xaf\xc0\xe6\xc3\x09\x00\x00"
 
 func runtimePluginsAutocloseAutocloseLuaBytes() ([]byte, error) {
        return bindataRead(
index dd4441813b94b277360d34c6ebdcc2b554638716..531b7601962d0a0881d773ccccc05587be47c30a 100644 (file)
@@ -28,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