diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/file_io.lua | 6 | ||||
-rw-r--r-- | core/gui.lua | 8 | ||||
-rw-r--r-- | core/init.lua | 2 | ||||
-rw-r--r-- | core/keys.lua | 19 |
4 files changed, 12 insertions, 23 deletions
diff --git a/core/file_io.lua b/core/file_io.lua index 28241b3b..b2e02ead 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -324,11 +324,9 @@ events.connect(events.VIEW_AFTER_SWITCH, update_modified_file) events.connect(events.BUFFER_NEW, function() local buffer = buffer buffer.reload = reload - buffer.set_encoding = set_encoding - buffer.save = save - buffer.save_as = save_as + buffer.save, buffer.save_as = save, save_as buffer.close = close - buffer.encoding = 'UTF-8' + buffer.encoding, buffer.set_encoding = 'UTF-8', set_encoding end) -- Close initial "Untitled" buffer. diff --git a/core/gui.lua b/core/gui.lua index e8159b59..c4461561 100644 --- a/core/gui.lua +++ b/core/gui.lua @@ -276,7 +276,6 @@ connect(events.BUFFER_NEW, function() local ok, err = pcall(set_properties) if not ok then io.stderr:write(err) end end) -connect(events.BUFFER_NEW, function() events.emit(events.UPDATE_UI) end) -- Sets the title of the Textadept window to the buffer's filename. -- @param buffer The global buffer. @@ -312,8 +311,9 @@ connect(events.URI_DROPPED, function(utf8_uris) end end end) -connect(events.APPLEEVENT_ODOC, - function(uri) return events.emit(events.URI_DROPPED, 'file://'..uri) end) +connect(events.APPLEEVENT_ODOC, function(uri) + return events.emit(events.URI_DROPPED, 'file://'..uri) +end) local string_format = string.format local EOLs = { L('CRLF'), L('CR'), L('LF') } @@ -339,6 +339,8 @@ connect(events.MARGIN_CLICK, function(margin, pos, modifiers) if margin == 2 then buffer:toggle_fold(buffer:line_from_position(pos)) end end) +-- Updates the statusbar and titlebar for a new Scintilla document. +connect(events.BUFFER_NEW, function() events.emit(events.UPDATE_UI) end) connect(events.BUFFER_NEW, function() set_title(buffer) end) -- Save buffer properties. diff --git a/core/init.lua b/core/init.lua index 285d4a9f..5543cf99 100644 --- a/core/init.lua +++ b/core/init.lua @@ -5,7 +5,7 @@ _RELEASE = "Textadept 5.0 alpha" package.path = _HOME..'/core/?.lua;'..package.path os.setlocale('C', 'collate') -if jit then require 'compat' end +if jit then require 'compat' end -- compatibility for LuaJIT _SCINTILLA = require 'iface' args = require 'args' locale = require 'locale' diff --git a/core/keys.lua b/core/keys.lua index aacd6560..9a186eed 100644 --- a/core/keys.lua +++ b/core/keys.lua @@ -96,15 +96,10 @@ module('keys')]] -- Therefore, any module containing key commands should be loaded after all -- other modules, whose functions are being referenced, have been loaded. --- settings local ADD = '' -local CTRL = 'c'..ADD -local ALT = 'a'..ADD -local META = 'm'..ADD -local SHIFT = 's'..ADD +local CTRL, ALT, META, SHIFT = 'c'..ADD, 'a'..ADD, 'm'..ADD, 's'..ADD M.CLEAR = 'esc' M.LANGUAGE_MODULE_PREFIX = (not OSX and CTRL or META)..'l' --- end settings -- Optimize for speed. local OSX = OSX @@ -174,10 +169,7 @@ end M.run_command = run_command -- export for menu.lua without creating LuaDoc -- Return codes for `run_key_command()`. -local INVALID = -1 -local PROPAGATE = 0 -local CHAIN = 1 -local HALT = 2 +local INVALID, PROPAGATE, CHAIN, HALT = -1, 0, 1, 2 -- Runs a key command associated with the current keychain. -- @param lexer Optional lexer name for lexer-specific commands. @@ -223,11 +215,8 @@ local function keypress(code, shift, control, alt, meta) key = M.KEYSYMS[code] if not key then return end end - control = control and CTRL or '' - alt = alt and ALT or '' - meta = meta and OSX and META or '' - shift = shift and SHIFT or '' - local key_seq = control..alt..meta..shift..key + local key_seq = (control and CTRL or '')..(alt and ALT or '').. + (meta and OSX and META or '')..(shift and SHIFT or '')..key --print(key_seq) if #keychain > 0 and key_seq == M.CLEAR then |