aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/session.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2014-06-12 21:18:13 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2014-06-12 21:18:13 -0400
commita9f6d85ead8c83ce210e5ffb05f84361e029f419 (patch)
treed7fcd5c957e3170f396eb515b94927174ad955d1 /modules/textadept/session.lua
parentd3e1bd0272a6ac75d927e0c7d5fcfde91d90bcc4 (diff)
downloadtextadept-a9f6d85ead8c83ce210e5ffb05f84361e029f419.tar.gz
textadept-a9f6d85ead8c83ce210e5ffb05f84361e029f419.zip
Lua code cleanup.
Diffstat (limited to 'modules/textadept/session.lua')
-rw-r--r--modules/textadept/session.lua9
1 files changed, 4 insertions, 5 deletions
diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua
index d2e1a921..fd5a595d 100644
--- a/modules/textadept/session.lua
+++ b/modules/textadept/session.lua
@@ -52,8 +52,8 @@ function M.load(filename)
local lfs_attributes = lfs.attributes
for line in f:lines() do
if line:find('^buffer:') then
- local anchor, current_pos, first_visible_line, filename =
- line:match('^buffer: (%d+) (%d+) (%d+) (.+)$')
+ local patt = '^buffer: (%d+) (%d+) (%d+) (.+)$'
+ local anchor, current_pos, first_visible_line, filename = line:match(patt)
if not filename:find('^%[.+%]$') then
if lfs_attributes(filename) then
io.open_file(filename)
@@ -65,9 +65,8 @@ function M.load(filename)
events.emit(events.FILE_OPENED, filename)
end
-- Restore saved buffer selection and view.
- local anchor = tonumber(anchor) or 0
- local current_pos = tonumber(current_pos) or 0
- local first_visible_line = tonumber(first_visible_line) or 0
+ anchor, current_pos = tonumber(anchor) or 0, tonumber(current_pos) or 0
+ first_visible_line = tonumber(first_visible_line) or 0
buffer._anchor, buffer._current_pos = anchor, current_pos
buffer._first_visible_line = first_visible_line
buffer:line_scroll(0, buffer:visible_from_doc_line(first_visible_line))