diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/events.lua | 2 | ||||
-rw-r--r-- | core/file_io.lua | 2 | ||||
-rw-r--r-- | core/init.lua | 2 | ||||
-rw-r--r-- | core/keys.lua | 6 | ||||
-rw-r--r-- | core/lfs_ext.lua | 6 | ||||
-rw-r--r-- | core/locale.lua | 2 |
6 files changed, 10 insertions, 10 deletions
diff --git a/core/events.lua b/core/events.lua index 34f90bf7..543133da 100644 --- a/core/events.lua +++ b/core/events.lua @@ -344,7 +344,7 @@ local error_emitted = false -- @usage events.emit('my_event', 'my message') -- @name emit function M.emit(event, ...) - assert(type(event) == 'string', 'string expectd') + assert(type(event) == 'string', 'string expected') local i = 1 while i <= #handlers[event] do local handler = handlers[event][i] diff --git a/core/file_io.lua b/core/file_io.lua index 28773cfa..97977b77 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -359,7 +359,7 @@ local vcs = {'.bzr', '.git', '.hg', '.svn'} -- @name get_project_root function io.get_project_root(path) local lfs_attributes = lfs.attributes - local dir = path or (buffer.filename or lfs.currentdir()):match('^(.+)[/\\]') + local dir = path or (buffer.filename or lfs.currentdir()..'/'):match('^(.+)[/\\]') while dir do for i = 1, #vcs do if lfs_attributes(dir..'/'..vcs[i], 'mode') then return dir end diff --git a/core/init.lua b/core/init.lua index 5724c908..f2d727d1 100644 --- a/core/init.lua +++ b/core/init.lua @@ -1,6 +1,6 @@ -- Copyright 2007-2020 Mitchell mitchell.att.foicica.com. See LICENSE. -_RELEASE = "Textadept 10.8" +_RELEASE = 'Textadept 10.8' _COPYRIGHT = 'Copyright © 2007-2020 Mitchell. See LICENSE.\n'.. 'http://foicica.com/textadept' diff --git a/core/keys.lua b/core/keys.lua index 74d52ff9..35af9bc8 100644 --- a/core/keys.lua +++ b/core/keys.lua @@ -152,13 +152,13 @@ local keychain = {} -- @name keychain M.keychain = setmetatable({}, { __index = keychain, - __newindex = function() error("read-only table") end, + __newindex = function() error('read-only table') end, __len = function() return #keychain end }) -- Clears the current key sequence. +-- Note: clearing a table is often faster than re-creating one. local function clear_key_sequence() - -- Clearing a table is sometimes faster than re-creating one. if #keychain == 1 then keychain[1] = nil else keychain = {} end end @@ -212,7 +212,7 @@ local function keypress(code, shift, control, alt, meta, caps_lock) --print(key_seq) ui.statusbar_text = '' - --if CURSES then ui.statusbar_text = '"'..key_seq..'"' end + --if CURSES then ui.statusbar_text = string.format('"%s"', key_seq) end local keychain_size = #keychain if keychain_size > 0 and key_seq == M.CLEAR then clear_key_sequence() diff --git a/core/lfs_ext.lua b/core/lfs_ext.lua index 05749df3..c71c42bc 100644 --- a/core/lfs_ext.lua +++ b/core/lfs_ext.lua @@ -76,11 +76,11 @@ function lfs.dir_foreach(dir, f, filter, n, include_dirs, level) end filter = processed_filter end - local dir_sep, lfs_attributes = not WIN32 and '/' or '\\', lfs.attributes + local dir_sep = not WIN32 and '/' or '\\' for basename in lfs.dir(dir) do if basename:find('^%.%.?$') then goto continue end -- ignore . and .. local filename = dir..(dir ~= '/' and dir_sep or '')..basename - local mode = lfs_attributes(filename, 'mode') + local mode = lfs.attributes(filename, 'mode') if mode ~= 'directory' and mode ~= 'file' then goto continue end local include if mode == 'file' then @@ -123,7 +123,7 @@ function lfs.abspath(filename, prefix) if WIN32 then filename = filename:gsub('/', '\\') end if not filename:find(not WIN32 and '^/' or '^%a:[/\\]') and not (WIN32 and filename:find('^\\\\')) then - prefix = prefix or lfs.currentdir() + if not prefix then prefix = lfs.currentdir() end filename = prefix..(not WIN32 and '/' or '\\')..filename end filename = filename:gsub('%f[^/\\]%.[/\\]', '') -- clean up './' diff --git a/core/locale.lua b/core/locale.lua index 2c94ef1c..48de4af5 100644 --- a/core/locale.lua +++ b/core/locale.lua @@ -17,7 +17,7 @@ if not f then if lang then f = io.open(_HOME..'/core/locales/locale.'..lang..'.conf') end end if not f then f = io.open(_HOME..'/core/locale.conf', 'rb') end -assert(f, '"core/locale.conf" not found.') +assert(f, '"core/locale.conf" not found') for line in f:lines() do -- Any line that starts with a non-word character except '[' is considered a -- comment. |