aboutsummaryrefslogtreecommitdiff
path: root/core/ext
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2009-02-10 10:24:56 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2009-02-10 10:24:56 -0500
commitddcc45f0615ab6ba776635a15e2183f8d50401a7 (patch)
tree958e817be2c18db9005db29ddcbdeeb72350d77e /core/ext
parent59c9eb6528d1759bc2734150cb3d99ec2e3eab5b (diff)
downloadtextadept-ddcc45f0615ab6ba776635a15e2183f8d50401a7.tar.gz
textadept-ddcc45f0615ab6ba776635a15e2183f8d50401a7.zip
Moved the textadept.locale table into the globals table.
Diffstat (limited to 'core/ext')
-rw-r--r--core/ext/command_entry.lua1
-rw-r--r--core/ext/find.lua7
-rw-r--r--core/ext/key_commands.lua1
-rw-r--r--core/ext/key_commands_mac.lua1
-rw-r--r--core/ext/key_commands_std.lua1
-rw-r--r--core/ext/keys.lua8
-rw-r--r--core/ext/menu.lua3
-rw-r--r--core/ext/mime_types.lua1
-rw-r--r--core/ext/pm/buffer_browser.lua7
-rw-r--r--core/ext/pm/ctags_browser.lua4
-rw-r--r--core/ext/pm/file_browser.lua3
-rw-r--r--core/ext/pm/macro_browser.lua2
-rw-r--r--core/ext/pm/modules_browser.lua3
-rw-r--r--core/ext/pm/project_browser.lua3
14 files changed, 23 insertions, 22 deletions
diff --git a/core/ext/command_entry.lua b/core/ext/command_entry.lua
index c583dc06..890c99e9 100644
--- a/core/ext/command_entry.lua
+++ b/core/ext/command_entry.lua
@@ -1,6 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
local textadept = _G.textadept
+local locale = _G.locale
local ce = textadept.command_entry
---
diff --git a/core/ext/find.lua b/core/ext/find.lua
index 566ff0d9..611a73ab 100644
--- a/core/ext/find.lua
+++ b/core/ext/find.lua
@@ -1,6 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
local textadept = _G.textadept
+local locale = _G.locale
local find = textadept.find
local MARK_REPLACEALL_END = 0
@@ -33,7 +34,6 @@ local escapes = {
function find.find(text, next, flags, nowrap, wrapped)
if #text == 0 then return end
local buffer = buffer
- local locale = textadept.locale
local first_visible_line = buffer.first_visible_line -- for 'no results found'
local increment
@@ -177,7 +177,6 @@ function find.replace(rtext)
end
local ret, rtext = pcall(rtext.gsub, rtext, '%%(%b())',
function(code)
- local locale = textadept.locale
local ret, val = pcall(loadstring('return '..code))
if not ret then
cocoa_dialog('msgbox', {
@@ -246,7 +245,7 @@ function find.replace_all(ftext, rtext, flags)
buffer:marker_delete_handle(end_marker)
end
textadept.statusbar_text =
- string.format(textadept.locale.FIND_REPLACEMENTS_MADE, tostring(count))
+ string.format(locale.FIND_REPLACEMENTS_MADE, tostring(count))
buffer:end_undo_action()
end
@@ -256,7 +255,7 @@ end
-- @param pos The position of the caret.
-- @param line_num The line double-clicked.
function goto_file(pos, line_num)
- if buffer._type == textadept.locale.FIND_FILES_FOUND_BUFFER then
+ if buffer._type == locale.FIND_FILES_FOUND_BUFFER then
line = buffer:get_line(line_num)
local file, line_num = line:match('^(.+):(%d+):.+$')
if file and line_num then
diff --git a/core/ext/key_commands.lua b/core/ext/key_commands.lua
index 89d7903e..1a378fb6 100644
--- a/core/ext/key_commands.lua
+++ b/core/ext/key_commands.lua
@@ -1,6 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
local textadept = _G.textadept
+local locale = _G.locale
---
-- Defines the key commands used by the Textadept key command manager.
diff --git a/core/ext/key_commands_mac.lua b/core/ext/key_commands_mac.lua
index 258c91a9..d7357726 100644
--- a/core/ext/key_commands_mac.lua
+++ b/core/ext/key_commands_mac.lua
@@ -1,6 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
local textadept = _G.textadept
+local locale = _G.locale
---
-- Defines the key commands used by the Textadept key command manager.
diff --git a/core/ext/key_commands_std.lua b/core/ext/key_commands_std.lua
index b6db26b6..04903a57 100644
--- a/core/ext/key_commands_std.lua
+++ b/core/ext/key_commands_std.lua
@@ -1,6 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
local textadept = _G.textadept
+local locale = _G.locale
---
-- Defines the key commands used by the Textadept key command manager.
diff --git a/core/ext/keys.lua b/core/ext/keys.lua
index 1a276861..08d5c606 100644
--- a/core/ext/keys.lua
+++ b/core/ext/keys.lua
@@ -1,6 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
local textadept = _G.textadept
+local locale = _G.locale
---
-- Manages key commands in Textadept.
@@ -205,7 +206,7 @@ local function keypress(code, shift, control, alt)
local size = #keychain - 1
clear_key_sequence()
if size > 0 then -- previously in a chain
- textadept.statusbar_text = textadept.locale.KEYS_INVALID
+ textadept.statusbar_text = locale.KEYS_INVALID
return true
end
else
@@ -243,8 +244,7 @@ end
try_get_cmd = function(active_table)
for _, key_seq in ipairs(keychain) do active_table = active_table[key_seq] end
if #active_table == 0 and next(active_table) then
- textadept.statusbar_text =
- textadept.locale.KEYCHAIN..table.concat(keychain, ' ')
+ textadept.statusbar_text = locale.KEYCHAIN..table.concat(keychain, ' ')
error(-1, 0)
else
local func = active_table[1]
@@ -258,7 +258,7 @@ try_get_cmd = function(active_table)
return view[func], { view, unpack(active_table, 3) }
end
else
- error(textadept.locale.KEYS_UNKNOWN_COMMAND..tostring(func))
+ error(locale.KEYS_UNKNOWN_COMMAND..tostring(func))
end
end
end
diff --git a/core/ext/menu.lua b/core/ext/menu.lua
index 9032c4b6..1a2b06ed 100644
--- a/core/ext/menu.lua
+++ b/core/ext/menu.lua
@@ -1,6 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
local textadept = _G.textadept
+local locale = _G.locale
---
-- Provides dynamic menus for Textadept.
@@ -8,7 +9,7 @@ local textadept = _G.textadept
module('textadept.menu', package.seeall)
local t = textadept
-local l = textadept.locale
+local l = locale
local gtkmenu = textadept.gtkmenu
local SEPARATOR = 'separator'
diff --git a/core/ext/mime_types.lua b/core/ext/mime_types.lua
index b35ee151..e4960e41 100644
--- a/core/ext/mime_types.lua
+++ b/core/ext/mime_types.lua
@@ -1,6 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
local textadept = _G.textadept
+local locale = _G.locale
--- Handles file-specific settings (based on file extension).
module('textadept.mime_types', package.seeall)
diff --git a/core/ext/pm/buffer_browser.lua b/core/ext/pm/buffer_browser.lua
index 0bac4818..e33c15aa 100644
--- a/core/ext/pm/buffer_browser.lua
+++ b/core/ext/pm/buffer_browser.lua
@@ -1,6 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
local textadept = _G.textadept
+local locale = _G.locale
---
-- Buffer browser for the Textadept project manager.
@@ -16,12 +17,11 @@ end
function get_contents_for()
local contents = {}
for index, buffer in ipairs(textadept.buffers) do
- local filename =
- buffer.filename or buffer._type or textadept.locale.UNTITLED
index = string.format("%02i", index)
contents[index] = {
pixbuf = buffer.dirty and 'gtk-edit' or 'gtk-file',
- text = filename:match('[^/\\]+$')
+ text =
+ (buffer.filename or buffer._type or locale.UNTITLED):match('[^/\\]+$')
}
end
return contents
@@ -39,7 +39,6 @@ end
local ID = { NEW = 1, OPEN = 2, SAVE = 3, SAVEAS = 4, CLOSE = 5 }
function get_context_menu(selected_item)
- local locale = textadept.locale
return {
{ locale.PM_BROWSER_BUFFER_NEW, ID.NEW },
{ locale.PM_BROWSER_BUFFER_OPEN, ID.OPEN },
diff --git a/core/ext/pm/ctags_browser.lua b/core/ext/pm/ctags_browser.lua
index 3a4ce826..7039d1c4 100644
--- a/core/ext/pm/ctags_browser.lua
+++ b/core/ext/pm/ctags_browser.lua
@@ -1,6 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
local textadept = _G.textadept
+local locale = _G.locale
---
-- CTags Browser for the Textadept project manager.
@@ -110,7 +111,6 @@ end
-- of the parent being expanded.
function get_contents_for(full_path, expanding)
local ctags_file = full_path[1]:sub(7) -- ignore 'ctags:'
- local locale = textadept.locale
local f
if #ctags_file == 0 then
tags = {}
@@ -221,7 +221,7 @@ function perform_action(selected_item)
buffer:goto_line(line)
else
error(
- string.format(textadept.locale.PM_BROWSER_CTAGS_NOT_FOUND, item.text))
+ string.format(locale.PM_BROWSER_CTAGS_NOT_FOUND, item.text))
end
elseif item.line_num then
textadept.io.open(item.filepath)
diff --git a/core/ext/pm/file_browser.lua b/core/ext/pm/file_browser.lua
index 8aa6cf96..45c1db4c 100644
--- a/core/ext/pm/file_browser.lua
+++ b/core/ext/pm/file_browser.lua
@@ -1,6 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
local textadept = _G.textadept
+local locale = _G.locale
---
-- File browser for the Textadept project manager.
@@ -48,7 +49,6 @@ end
local ID = { CHANGE_DIR = 1, FILE_INFO = 2 }
function get_context_menu(selected_item)
- local locale = textadept.locale
return {
{ 'separator', 0 }, -- make it harder to click 'Change Directory' by mistake
{ locale.PM_BROWSER_FILE_CD, ID.CHANGE_DIR },
@@ -57,7 +57,6 @@ function get_context_menu(selected_item)
end
function perform_menu_action(menu_id, selected_item)
- local locale = textadept.locale
local filepath = table.concat(selected_item, '/')
if menu_id == ID.CHANGE_DIR then
textadept.pm.entry_text = filepath
diff --git a/core/ext/pm/macro_browser.lua b/core/ext/pm/macro_browser.lua
index 75e9e91f..32bd86ff 100644
--- a/core/ext/pm/macro_browser.lua
+++ b/core/ext/pm/macro_browser.lua
@@ -1,6 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
local textadept = _G.textadept
+local locale = _G.locale
---
-- Macro browser for the Textadept project manager.
@@ -28,7 +29,6 @@ end
local ID = { DELETE = 1 }
function get_context_menu(selected_item)
- local locale = textadept.locale
return { { locale.PM_BROWSER_MACRO_DELETE, ID.DELETE } }
end
diff --git a/core/ext/pm/modules_browser.lua b/core/ext/pm/modules_browser.lua
index 174394a6..921dc455 100644
--- a/core/ext/pm/modules_browser.lua
+++ b/core/ext/pm/modules_browser.lua
@@ -1,6 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
local textadept = _G.textadept
+local locale = _G.locale
---
-- Modules browser for the Textadept project manager.
@@ -113,7 +114,6 @@ local ID = {
}
function get_context_menu(selected_item)
- local locale = textadept.locale
return {
{ locale.PM_BROWSER_MODULE_NEW, ID.NEW },
{ locale.PM_BROWSER_MODULE_DELETE, ID.DELETE },
@@ -125,7 +125,6 @@ function get_context_menu(selected_item)
end
function perform_menu_action(menu_id, selected_item)
- local locale = textadept.locale
if menu_id == ID.NEW then
local status, module_name =
cocoa_dialog('standard-inputbox', {
diff --git a/core/ext/pm/project_browser.lua b/core/ext/pm/project_browser.lua
index b1609ad1..30616ef9 100644
--- a/core/ext/pm/project_browser.lua
+++ b/core/ext/pm/project_browser.lua
@@ -1,6 +1,7 @@
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.
local textadept = _G.textadept
+local locale = _G.locale
---
-- Browser template for the Textadept project manager.
@@ -84,7 +85,6 @@ local ID = {
--- Displays the project manager context menu.
function get_context_menu(selected_item)
- local locale = textadept.locale
return {
{ 'separator', 0 }, -- make it harder to click 'New Project' by mistake
{ locale.PM_BROWSER_PROJECT_NEW, ID.NEW },
@@ -101,7 +101,6 @@ function get_context_menu(selected_item)
end
function perform_menu_action(menu_id, selected_item)
- local locale = textadept.locale
if menu_id == ID.NEW then
-- Close all open files and prompt the user to save a project file.
if textadept.io.close_all() then