aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept
diff options
context:
space:
mode:
Diffstat (limited to 'modules/textadept')
-rw-r--r--modules/textadept/bookmarks.lua1
-rw-r--r--modules/textadept/editing.lua9
-rw-r--r--modules/textadept/mime_types.lua21
-rw-r--r--modules/textadept/run.lua7
-rw-r--r--modules/textadept/session.lua33
-rw-r--r--modules/textadept/snippets.lua3
6 files changed, 34 insertions, 40 deletions
diff --git a/modules/textadept/bookmarks.lua b/modules/textadept/bookmarks.lua
index 2b95df1d..581390d4 100644
--- a/modules/textadept/bookmarks.lua
+++ b/modules/textadept/bookmarks.lua
@@ -1,6 +1,5 @@
-- Copyright 2007-2010 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local textadept = _G.textadept
local locale = _G.locale
---
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index 2d1586a2..6c8cd680 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -1,6 +1,5 @@
-- Copyright 2007-2010 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local textadept = _G.textadept
local locale = _G.locale
local events = _G.events
@@ -227,10 +226,10 @@ function goto_line(line)
local buffer = buffer
if not line then
line =
- textadept.dialog('standard-inputbox',
- '--title', locale.M_TEXTADEPT_EDITING_GOTO_TITLE,
- '--text', locale.M_TEXTADEPT_EDITING_GOTO_TEXT,
- '--no-newline')
+ gui.dialog('standard-inputbox',
+ '--title', locale.M_TEXTADEPT_EDITING_GOTO_TITLE,
+ '--text', locale.M_TEXTADEPT_EDITING_GOTO_TEXT,
+ '--no-newline')
line = tonumber(line:match('%-?%d+$'))
if not line or line < 0 then return end
end
diff --git a/modules/textadept/mime_types.lua b/modules/textadept/mime_types.lua
index f3265b53..96f56216 100644
--- a/modules/textadept/mime_types.lua
+++ b/modules/textadept/mime_types.lua
@@ -1,6 +1,5 @@
-- Copyright 2007-2010 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local textadept = _G.textadept
local locale = _G.locale
local events = _G.events
@@ -26,8 +25,8 @@ module('_m.textadept.mime_types', package.seeall)
--
-- ## Configuration Files
--
--- Built-in mime-types are located in `core/ext/mime_types.conf`. You can
--- override or add to them in your `~/.textadept/mime_types.conf`.
+-- Built-in mime-types are located in `modules/textadept/mime_types.conf`. You
+-- can override or add to them in your `~/.textadept/mime_types.conf`.
--
-- #### Detection by File Extension
--
@@ -253,14 +252,14 @@ events.connect('reset_after', function() buffer:set_lexer(buffer._lexer) end)
-- buffer.
function select_lexer()
local out =
- textadept.dialog('filteredlist',
- '--title', locale.MT_SELECT_LEXER,
- '--button1', 'gtk-ok',
- '--button2', 'gtk-cancel',
- '--no-newline',
- '--string-output',
- '--columns', 'Name',
- '--items', unpack(lexers))
+ gui.dialog('filteredlist',
+ '--title', locale.MT_SELECT_LEXER,
+ '--button1', 'gtk-ok',
+ '--button2', 'gtk-cancel',
+ '--no-newline',
+ '--string-output',
+ '--columns', 'Name',
+ '--items', unpack(lexers))
local response, lexer = out:match('([^\n]+)\n([^\n]+)$')
if response and response ~= 'gtk-cancel' then buffer:set_lexer(lexer) end
end
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index a576ff27..78b1fbdb 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -1,6 +1,5 @@
-- Copyright 2007-2010 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local textadept = _G.textadept
local locale = _G.locale
---
@@ -19,7 +18,7 @@ module('_m.textadept.run', package.seeall)
-- * %(filename) The name of the file including extension.
-- * %(filename_noext) The name of the file excluding extension.
function execute(command)
- local filepath = textadept.iconv(buffer.filename, _CHARSET, 'UTF-8')
+ local filepath = buffer.filename:iconv(_CHARSET, 'UTF-8')
local filedir, filename
if filepath:find('[/\\]') then
filedir, filename = filepath:match('^(.+[/\\])([^/\\]+)$')
@@ -39,7 +38,7 @@ function execute(command)
local out = p:read('*all')
p:close()
lfs.chdir(current_dir)
- textadept.print(textadept.iconv('> '..command..'\n'..out, 'UTF-8', _CHARSET))
+ gui.print(('> '..command..'\n'..out):iconv('UTF-8', _CHARSET))
buffer:goto_pos(buffer.length)
end
@@ -115,7 +114,7 @@ function goto_error(pos, line_num)
if #captures > 0 then
local lfs = require 'lfs'
local utf8_filename = captures[error_detail.filename]
- local filename = textadept.iconv(utf8_filename, _CHARSET, 'UTF-8')
+ local filename = utf8_filename:iconv(_CHARSET, 'UTF-8')
if lfs.attributes(filename) then
io.open_file(utf8_filename)
_m.textadept.editing.goto_line(captures[error_detail.line])
diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua
index 3535bca1..22f19c11 100644
--- a/modules/textadept/session.lua
+++ b/modules/textadept/session.lua
@@ -1,6 +1,5 @@
-- Copyright 2007-2010 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local textadept = _G.textadept
local locale = _G.locale
---
@@ -49,7 +48,7 @@ function load(filename)
not_found[#not_found + 1] = filename
end
else
- textadept.new_buffer()
+ new_buffer()
buffer._type = filename
events.handle('file_opened', filename)
end
@@ -73,7 +72,7 @@ function load(filename)
local level, num, buf_idx = line:match('^(%s*)view(%d): (%d+)$')
local view = splits[#level][tonumber(num)] or view
buf_idx = tonumber(buf_idx)
- if buf_idx > #textadept.buffers then buf_idx = #textadept.buffers end
+ if buf_idx > #_BUFFERS then buf_idx = #_BUFFERS end
view:goto_buffer(buf_idx)
elseif line:find('^current_view:') then
local view_idx = line:match('^current_view: (%d+)')
@@ -81,18 +80,18 @@ function load(filename)
end
if line:find('^size:') then
local width, height = line:match('^size: (%d+) (%d+)$')
- if width and height then textadept.size = { width, height } end
+ if width and height then gui.size = { width, height } end
end
end
f:close()
- textadept.views[current_view]:focus()
- textadept.session_file = filename or DEFAULT_SESSION
+ _VIEWS[current_view]:focus()
+ _SESSIONFILE = filename or DEFAULT_SESSION
if #not_found > 0 then
- textadept.dialog('msgbox',
- '--title', locale.M_SESSION_FILES_NOT_FOUND_TITLE,
- '--text', locale.M_SESSION_FILES_NOT_FOUND_TEXT,
- '--informative-text',
- string.format('%s', table.concat(not_found, '\n')))
+ gui.dialog('msgbox',
+ '--title', locale.M_SESSION_FILES_NOT_FOUND_TITLE,
+ '--text', locale.M_SESSION_FILES_NOT_FOUND_TEXT,
+ '--informative-text',
+ string.format('%s', table.concat(not_found, '\n')))
end
return true
end
@@ -110,10 +109,10 @@ function save(filename)
local split_line = "%ssplit%d: %s %d" -- level, number, type, size
local view_line = "%sview%d: %d" -- level, number, doc index
-- Write out opened buffers.
- for _, buffer in ipairs(textadept.buffers) do
+ for _, buffer in ipairs(_BUFFERS) do
local filename = buffer.filename or buffer._type
if filename then
- local current = buffer.doc_pointer == textadept.focused_doc_pointer
+ local current = buffer.doc_pointer == gui.focused_doc_pointer
local anchor = current and 'anchor' or '_anchor'
local current_pos = current and 'current_pos' or '_current_pos'
local first_visible_line =
@@ -141,7 +140,7 @@ function save(filename)
session[#session + 1] = view_line:format(spaces, 2, c2)
end
end
- local splits = textadept.get_split_table()
+ local splits = gui.get_split_table()
if type(splits) == 'table' then
write_split(splits, 0, 0)
else
@@ -149,7 +148,7 @@ function save(filename)
end
-- Write out the current focused view.
local current_view = view
- for index, view in ipairs(textadept.views) do
+ for index, view in ipairs(_VIEWS) do
if view == current_view then
current_view = index
break
@@ -157,11 +156,11 @@ function save(filename)
end
session[#session + 1] = ("current_view: %d"):format(current_view)
-- Write out other things.
- local size = textadept.size
+ local size = gui.size
session[#session + 1] = ("size: %d %d"):format(size[1], size[2])
-- Write the session.
local f =
- io.open_file(filename or textadept.session_file or DEFAULT_SESSION, 'wb')
+ io.open_file(filename or _SESSIONFILE or DEFAULT_SESSION, 'wb')
if f then
f:write(table.concat(session, '\n'))
f:close()
diff --git a/modules/textadept/snippets.lua b/modules/textadept/snippets.lua
index 07ab0c8f..cb79987b 100644
--- a/modules/textadept/snippets.lua
+++ b/modules/textadept/snippets.lua
@@ -1,6 +1,5 @@
-- Copyright 2007-2010 Mitchell mitchell<att>caladbolg.net. See LICENSE.
-local textadept = _G.textadept
local locale = _G.locale
---
@@ -477,4 +476,4 @@ function show_style()
buffer:call_tip_show(buffer.current_pos, text)
end
-textadept.user_dofile('snippets.lua') -- load user snippets
+user_dofile('snippets.lua') -- load user snippets