aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/cpp/commands.lua4
-rw-r--r--modules/cpp/snippets.lua2
-rw-r--r--modules/lua/commands.lua6
-rw-r--r--modules/textadept/run.lua13
4 files changed, 15 insertions, 10 deletions
diff --git a/modules/cpp/commands.lua b/modules/cpp/commands.lua
index d1e2fd17..65c3f8af 100644
--- a/modules/cpp/commands.lua
+++ b/modules/cpp/commands.lua
@@ -12,7 +12,9 @@ if type(keys) == 'table' then
local m_editing = _m.textadept.editing
keys.cpp = {
al = {
- m = { textadept.io.open, _HOME..'/modules/cpp/init.lua' },
+ m = { textadept.io.open,
+ textadept.iconv(_HOME..'/modules/cpp/init.lua',
+ 'UTF-8', _CHARSET) },
},
['s\n'] = { function()
buffer:line_end()
diff --git a/modules/cpp/snippets.lua b/modules/cpp/snippets.lua
index 4f2c5833..8a4e0291 100644
--- a/modules/cpp/snippets.lua
+++ b/modules/cpp/snippets.lua
@@ -49,7 +49,7 @@ if type(snippets) == 'table' then
lrsi = 'lua_rawseti(%1(lua), %2(-2), %3(1));',
lr = 'lua_register(%1(lua), %2(fname), %3(cfunction));',
lsf = 'lua_setfield(%1(lua), %2(-2), %3(field));',
- lsg = 'lua_setglobal(%1(lua), %2(-2), %3(global));',
+ lsg = 'lua_setglobal(%1(lua), %2(global));',
lst = 'lua_settable(%1(lua), %2(-3));',
ltb = 'lua_toboolean(%1(lua), %2(-1))',
ltcf = 'lua_tocfunction(%1(lua), %2(-1))',
diff --git a/modules/lua/commands.lua b/modules/lua/commands.lua
index 47e872e0..8055f470 100644
--- a/modules/lua/commands.lua
+++ b/modules/lua/commands.lua
@@ -59,7 +59,7 @@ function goto_required()
for path in package.path:gmatch('[^;]+') do
path = path:gsub('?', file)
if lfs.attributes(file) then
- textadept.io.open(path)
+ textadept.io.open(textadept.iconv(path, 'UTF-8', _CHARSET))
break
end
end
@@ -71,7 +71,9 @@ if type(keys) == 'table' then
local m_editing = _m.textadept.editing
keys.lua = {
al = {
- m = { textadept.io.open, _HOME..'/modules/lua/init.lua' },
+ m = { textadept.io.open,
+ textadept.iconv(_HOME..'/modules/lua/init.lua',
+ 'UTF-8', _CHARSET) },
g = { goto_required },
},
['s\n'] = { try_to_autocomplete_end },
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index c45d9019..594b4657 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -16,11 +16,11 @@ 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 = buffer.filename
+ local filepath = textadept.iconv(buffer.filename, _CHARSET, 'UTF-8')
local filedir, filename = filepath:match('^(.+[/\\])([^/\\]+)$')
local filename_noext = filename:match('^(.+)%.')
command = command:gsub('%%%b()', {
- ['%(filepath)'] = filepath,
+ ['%(filepath)'] = filepath, _CHARSET, 'UTF-8',
['%(filedir)'] = filedir,
['%(filename)'] = filename,
['%(filename_noext)'] = filename_noext,
@@ -31,7 +31,7 @@ function execute(command)
local out = p:read('*all')
p:close()
lfs.chdir(current_dir)
- textadept.print('> '..command..'\n'..out)
+ textadept.print(textadept.iconv('> '..command..'\n'..out, 'UTF-8', _CHARSET))
buffer:goto_pos(buffer.length)
end
@@ -136,15 +136,16 @@ function goto_error(pos, line_num)
local captures = { line:match(error_detail.pattern) }
if #captures > 0 then
local lfs = require 'lfs'
- local filename = captures[error_detail.filename]
+ local utf8_filename = captures[error_detail.filename]
+ local filename = textadept.iconv(utf8_filename, _CHARSET, 'UTF-8')
if lfs.attributes(filename) then
- textadept.io.open(filename)
+ textadept.io.open(utf8_filename)
_m.textadept.editing.goto_line(captures[error_detail.line])
local msg = captures[error_detail.message]
if msg then buffer:call_tip_show(buffer.current_pos, msg) end
else
error(string.format(
- locale.M_TEXTADEPT_RUN_FILE_DOES_NOT_EXIST, filename))
+ locale.M_TEXTADEPT_RUN_FILE_DOES_NOT_EXIST, utf8_filename))
end
break
end