From 78990df4f114c45adc7fd2678ffaedf0c4124d95 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 29 Apr 2013 16:13:59 -0400 Subject: More code cleanup. "local buffer = buffer" and similar optimizations are not needed since lexing the buffer is much more expensive and reaction time is limited by how fast the keyboard can submit key presses. --- core/gui.lua | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'core/gui.lua') diff --git a/core/gui.lua b/core/gui.lua index 6869468f..445a65de 100644 --- a/core/gui.lua +++ b/core/gui.lua @@ -19,8 +19,6 @@ local gui = gui -- The text displayed by the buffer statusbar. module('gui')]] -local _L = _L - -- Helper function for printing messages to buffers. -- @see gui._print local function _print(buffer_type, ...) @@ -161,6 +159,7 @@ end local theme_file = not CURSES and 'theme' or 'theme_term' local THEME + --- -- Sets the editor theme name to *name* or the default platform theme. -- Themes with *name* in the *`_USERHOME`/themes/* directory override themes of @@ -348,23 +347,21 @@ events_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']} local GETLEXERLANGUAGE = _SCINTILLA.properties.lexer_language[1] -- Sets docstatusbar text. events_connect(events.UPDATE_UI, function() - local buffer = buffer local pos = buffer.current_pos local line, max = buffer:line_from_position(pos) + 1, buffer.line_count local col = buffer.column[pos] + 1 local lexer = buffer:private_lexer_call(GETLEXERLANGUAGE):match('^[^/]+') local eol = EOLs[buffer.eol_mode + 1] - local tabs = string_format('%s %d', buffer.use_tabs and _L['Tabs:'] or + local tabs = string.format('%s %d', buffer.use_tabs and _L['Tabs:'] or _L['Spaces:'], buffer.tab_width) local enc = buffer.encoding or '' local text = not CURSES and '%s %d/%d %s %d %s %s %s %s' or '%s %d/%d %s %d %s %s %s %s' - gui.docstatusbar_text = string_format(text, _L['Line:'], line, max, + gui.docstatusbar_text = string.format(text, _L['Line:'], line, max, _L['Col:'], col, lexer, eol, tabs, enc) end) -- cgit v1.2.3