Last active
October 8, 2017 00:09
-
-
Save pkulchenko/b4f05b5c7658ce0b82ccd01fa08b3cbb to your computer and use it in GitHub Desktop.
Add `reset` to clear console environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/editor/shellbox.lua b/src/editor/shellbox.lua | |
index 6a9a776..70a29cb 100644 | |
--- a/src/editor/shellbox.lua | |
+++ b/src/editor/shellbox.lua | |
@@ -400,9 +400,10 @@ end | |
local function displayShellIntro() | |
DisplayShellMsg(TR("Welcome to the interactive Lua interpreter.").." " | |
- ..TR("Enter Lua code and press Enter to run it.").."\n" | |
- ..TR("Use Shift-Enter for multiline code.").." " | |
- ..TR("Use 'clear' to clear the shell output and the history.").."\n" | |
+ ..TR("Enter Lua code and press Enter to run it.").." " | |
+ ..TR("Use Shift-Enter for multiline code.").."\n" | |
+ ..TR("Use 'clear' to clear the shell output and the history.").." " | |
+ ..TR("Use 'reset' to clear everything, including the environment.").."\n" | |
..TR("Prepend '=' to show complex values on multiple lines.").." " | |
..TR("Prepend '!' to force local execution.")) | |
DisplayShellPrompt('') | |
@@ -502,6 +503,8 @@ console:Connect(wx.wxEVT_KEY_DOWN, | |
if #promptText == 0 then return end -- nothing to execute, exit | |
if promptText == 'clear' then | |
console:Erase() | |
+ elseif promptText == 'reset' then | |
+ console:Reset() | |
else | |
displayShellDirect('\n') | |
executeShellCode(promptText) | |
@@ -588,3 +591,8 @@ function console:Erase() | |
self:ClearAll() | |
displayShellIntro() | |
end | |
+ | |
+function console:Reset() | |
+ env = createenv() -- recreate the environment to "forget" all changes in it | |
+end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment