From bc763f8042a55ed87eb733fa79cf9abfc2ac6fd6 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sat, 16 Apr 2016 21:10:50 -0400 Subject: Added menu item and dialog for setting run/compile command arguments. --- core/locale.conf | 4 ++++ core/locales/locale.ar.conf | 4 ++++ core/locales/locale.de.conf | 4 ++++ core/locales/locale.es.conf | 4 ++++ core/locales/locale.fr.conf | 4 ++++ core/locales/locale.it.conf | 4 ++++ core/locales/locale.pl.conf | 4 ++++ core/locales/locale.ru.conf | 4 ++++ core/locales/locale.sv.conf | 4 ++++ modules/textadept/menu.lua | 27 +++++++++++++++++++++++++++ 10 files changed, 63 insertions(+) diff --git a/core/locale.conf b/core/locale.conf index 2355ea7e..4a66df7a 100644 --- a/core/locale.conf +++ b/core/locale.conf @@ -178,6 +178,10 @@ Command _Entry = Command _Entry Select Co_mmand = Select Co_mmand _Run = _Run _Compile = _Compile +Set _Arguments... = Set _Arguments... +Command line arguments = Command line arguments +For Run: = For Run: +For Compile: = For Compile: Buil_d = Buil_d S_top = S_top _Next Error = _Next Error diff --git a/core/locales/locale.ar.conf b/core/locales/locale.ar.conf index 8169dbf1..a97bc0d0 100644 --- a/core/locales/locale.ar.conf +++ b/core/locales/locale.ar.conf @@ -179,6 +179,10 @@ Command _Entry = أ_كتب أمرًا Select Co_mmand = ا_ختر أمرًا _Run = _شغل _Compile = _ترجم +Set _Arguments... = Set _Arguments... +Command line arguments = Command line arguments +For Run: = For Run: +For Compile: = For Compile: Buil_d = ا_بْن ِ S_top = قِفْ _Next Error = اذهب لل_خطأ التالي diff --git a/core/locales/locale.de.conf b/core/locales/locale.de.conf index 34609f9c..b7a2b579 100644 --- a/core/locales/locale.de.conf +++ b/core/locales/locale.de.conf @@ -168,6 +168,10 @@ Command _Entry = Befehlseingabe Select Co_mmand = Befehl auswählen _Run = Ausführen _Compile = Kompilieren +Set _Arguments... = Set _Arguments... +Command line arguments = Command line arguments +For Run: = For Run: +For Compile: = For Compile: Buil_d = Build starten S_top = Stoppen _Next Error = Nächstes Fehler diff --git a/core/locales/locale.es.conf b/core/locales/locale.es.conf index 0e0db24a..d4e87a0e 100644 --- a/core/locales/locale.es.conf +++ b/core/locales/locale.es.conf @@ -179,6 +179,10 @@ Command _Entry = _Línea de comandos Select Co_mmand = _Seleccionar comandos _Run = _Ejecutar _Compile = _Compilar +Set _Arguments... = Set _Arguments... +Command line arguments = Command line arguments +For Run: = For Run: +For Compile: = For Compile: Buil_d = Co_nstruir S_top = _Detener _Next Error = Error sig_uiente diff --git a/core/locales/locale.fr.conf b/core/locales/locale.fr.conf index e022b61c..5938edef 100644 --- a/core/locales/locale.fr.conf +++ b/core/locales/locale.fr.conf @@ -180,6 +180,10 @@ Command _Entry = L_igne de commande Select Co_mmand = Choisir la co_mmande... _Run = _Lancer _Compile = _Compiler +Set _Arguments... = Set _Arguments... +Command line arguments = Command line arguments +For Run: = For Run: +For Compile: = For Compile: Buil_d = C_onstruire S_top = _Arrêter _Next Error = Erreur _suivante diff --git a/core/locales/locale.it.conf b/core/locales/locale.it.conf index 30143322..781267c8 100644 --- a/core/locales/locale.it.conf +++ b/core/locales/locale.it.conf @@ -179,6 +179,10 @@ Command _Entry = _Immetti un comando Select Co_mmand = _Scegli un comando... _Run = Ese_gui _Compile = _Compila +Set _Arguments... = Set _Arguments... +Command line arguments = Command line arguments +For Run: = For Run: +For Compile: = For Compile: Buil_d = C_ostruisci S_top = _Arresta _Next Error = Errore s_eguente diff --git a/core/locales/locale.pl.conf b/core/locales/locale.pl.conf index 2c5ddf51..089fe10f 100644 --- a/core/locales/locale.pl.conf +++ b/core/locales/locale.pl.conf @@ -179,6 +179,10 @@ Command _Entry = Wiersz po_leceń Select Co_mmand = _Wybierz polecenie... _Run = _Uruchom _Compile = _Skompiluj +Set _Arguments... = Set _Arguments... +Command line arguments = Command line arguments +For Run: = For Run: +For Compile: = For Compile: Buil_d = Z_buduj S_top = Pr_zerwij _Next Error = _Następny błąd diff --git a/core/locales/locale.ru.conf b/core/locales/locale.ru.conf index 3bfc8b09..f597abf0 100644 --- a/core/locales/locale.ru.conf +++ b/core/locales/locale.ru.conf @@ -168,6 +168,10 @@ Command _Entry = Командная _строка Select Co_mmand = Выбрать _команду _Run = _Запустить _Compile = _Скомпилировать +Set _Arguments... = Set _Arguments... +Command line arguments = Command line arguments +For Run: = For Run: +For Compile: = For Compile: Buil_d = С_обрать S_top = Ос_тановить _Next Error = Следующая Ошибка diff --git a/core/locales/locale.sv.conf b/core/locales/locale.sv.conf index 61056ca5..9b3ba15a 100644 --- a/core/locales/locale.sv.conf +++ b/core/locales/locale.sv.conf @@ -180,6 +180,10 @@ Command _Entry = _Kommandorad... Select Co_mmand = _Välj kommando... _Run = K_ör _Compile = Ko_mpilera +Set _Arguments... = Set _Arguments... +Command line arguments = Command line arguments +For Run: = For Run: +For Compile: = For Compile: Buil_d = B_ygg S_top = Avbry_t _Next Error = _Nästa fel diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua index 91a0d60a..4e7cc785 100644 --- a/modules/textadept/menu.lua +++ b/modules/textadept/menu.lua @@ -173,6 +173,33 @@ local default_menubar = { SEPARATOR, {_L['_Run'], textadept.run.run}, {_L['_Compile'], textadept.run.compile}, + {_L['Set _Arguments...'], function() + if not buffer.filename then return end + local run_commands = textadept.run.run_commands + local compile_commands = textadept.run.compile_commands + local base_commands, utf8_args = {}, {} + for i, commands in ipairs{run_commands, compile_commands} do + -- Compare the base run/compile command with the one for the current + -- file. The difference is any additional arguments set previously. + base_commands[i] = commands[buffer.filename:match('[^.]+$')] or + commands[buffer:get_lexer()] + local current_command = (commands[buffer.filename] or '') + local args = current_command:sub(#base_commands[i] + 2) + utf8_args[i] = args:iconv('UTF-8', _CHARSET) + end + local button, utf8_args = ui.dialogs.inputbox{ + title = _L['Set _Arguments...']:gsub('_', ''), informative_text = { + _L['Command line arguments'], _L['For Run:'], _L['For Compile:'] + }, text = utf8_args, width = not CURSES and 400 or nil + } + if button ~= 1 then return end + for i, commands in ipairs{run_commands, compile_commands} do + -- Add the additional arguments to the base run/compile command and set + -- the new command to be the one used for the current file. + commands[buffer.filename] = base_commands[i]..' '.. + utf8_args[i]:iconv(_CHARSET, 'UTF-8') + end + end}, {_L['Buil_d'], textadept.run.build}, {_L['S_top'], textadept.run.stop}, {_L['_Next Error'], function() textadept.run.goto_error(false, true) end}, -- cgit v1.2.3