From 488ccfb4d909dc1511626230cd548955e42211d3 Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 19 Dec 2020 13:57:12 -0500 Subject: [PATCH 1/4] Start to suport Unicode as a CLI option --- mathicsscript/__main__.py | 8 +- mathicsscript/format.py | 5 +- mathicsscript/inputrc | 151 +----------------------------- mathicsscript/inputrc-no-unicode | 56 +++++++++++ mathicsscript/inputrc-unicode | 154 +++++++++++++++++++++++++++++++ mathicsscript/termshell.py | 20 +++- setup.py | 4 +- test/test_completion.py | 6 +- 8 files changed, 245 insertions(+), 159 deletions(-) create mode 100644 mathicsscript/inputrc-no-unicode create mode 100644 mathicsscript/inputrc-unicode diff --git a/mathicsscript/__main__.py b/mathicsscript/__main__.py index 786abbd..0cbca4c 100755 --- a/mathicsscript/__main__.py +++ b/mathicsscript/__main__.py @@ -144,6 +144,11 @@ def out(self, out): default=True, help="GNU Readline line editing. enable tab completion", ) +@click.option( + "--unicode/--no-unicode", + default=True, + help="GNU Readline line editing. If this is off completion and command history are also turned off", +) @click.option( "--pyextensions", "-l", @@ -188,6 +193,7 @@ def main( quiet, readline, completion, + unicode, pyextensions, execute, initfile, @@ -220,7 +226,7 @@ def main( "Settings`$PygmentsShowTokens", from_python(1 if pygments_tokens else 0) ) - shell = TerminalShell(definitions, style, readline, completion) + shell = TerminalShell(definitions, style, readline, completion, unicode) load_settings(shell) if initfile: with open(initfile, "r") as ifile: diff --git a/mathicsscript/format.py b/mathicsscript/format.py index 303fbde..b824d6a 100644 --- a/mathicsscript/format.py +++ b/mathicsscript/format.py @@ -29,8 +29,8 @@ def format_output(obj, expr, format=None): expr = leaves[0] elif expr_type in ("System`Graphics", "System`Plot"): result = "-System Graphics-" - # result = Expression("StandardForm", expr).format(obj, "System`MathMLForm") - # ml_str = result.leaves[0].leaves[0] + result = Expression("StandardForm", expr).format(obj, "System`MathMLForm") + ml_str = result.leaves[0].leaves[0] # FIXME: not quite right. Need to parse out strings # display_svg(str(ml_str)) @@ -379,7 +379,6 @@ def format_graph(G): if graph_layout in ["circular", "spiral", "spiral_equidistant"]: plt.axes().set_aspect("equal") - harmonize_parameters(G, draw_options) if layout_fn: diff --git a/mathicsscript/inputrc b/mathicsscript/inputrc index 615328e..0b8c3cc 100644 --- a/mathicsscript/inputrc +++ b/mathicsscript/inputrc @@ -1,153 +1,4 @@ -# GNU Readline input translations - -# Lowercase TeX Greek characters -"\e\\alpha\e": "α" -"\e\\beta\e": "β" -"\e\\gamma\e": "γ" -"\e\\delta\e": "δ" -"\e\\epsilon\e": "ε" -"\e\\zeta\e": "ζ" -"\e\\eta\e": "η" -"\e\\theta\e": "θ" -"\e\\iota\e": "ι" -"\e\\kappa\e": "κ" -"\e\\lambda\e": "λ" -"\e\\mu\e": "μ" -"\e\\nu\e": "ν" -"\e\\xi\e": "ξ" -"\e\\omicron\e": "ο" -"\e\\pi\e": "π" -"\e\\rho\e": "ρ" -"\e\\varsigma\e": "ς" -"\e\\sigma\e": "σ" -"\e\\tau\e": "τ" -"\e\\upsilon\e": "υ" -"\e\\phi\e": "φ" -"\e\\chi\e": "χ" -"\e\\psi\e": "ψ" -"\e\\omega\e": "ω" - -# Lowercase named Greek characters -"\ea\e": "α" -"\eb\e": "β" -"\eg\e": "γ" -"\ed\e": "δ" -"\ee\e": "ε" -"\ez\e": "ζ" -"\ee\e": "η" -"\et\e": "θ" -"\ei\e": "ι" -"\ek\e": "κ" -"\el\e": "λ" -"\em\e": "μ" -"\en\e": "ν" -"\ex\e": "ξ" -"\eo\e": "ω" -"\ep\e": "π" -"\er\e": "ρ" -"\ev\e": "ς" -"\es\e": "σ" -"\et\e": "τ" -"\eu\e": "υ" -# "\e\\phi\e": "φ" # ? -# "\e\\chi\e": "χ" # ? -# "\e\\psi\e": "ψ" # ? - -# Uppercase TeX Greek symbols -"\e\\Gamma\e": "Γ" -"\e\\Delta\e": "Δ" -"\e\\Theta\e": "Θ" -"\e\\Lambda\e": "Λ" -"\e\\Xi\e": "Ξ" -"\e\\Pi\e": "Π" -"\e\\Sigma\e": "Σ" -"\e\\Upsilon\e": "Υ" -"\e\\Phi\e": "Φ" -"\e\\Psi\e": "Ψ" -"\e\\Omega\e": "Ω" - -# Things we have Unicode symbols for -"\e.a\e": "ạ" -"\e$a\e": "ạ" -"\e.A\e": "Ạ" -"\e$A\e": "Ạ" -"\e.B\e": "Ḅ" -"\e$B\e": "Ḅ" -"\e.b\e": "ḅ" -"\e$b\e": "ḅ" -"\e.D\e": "Ḍ" -"\e$D\e": "Ḍ" -"\e.d\e": "ḍ" -"\e$d\e": "ḍ" -"\e.E\e": "Ẹ" -"\e$E\e": "Ẹ" -"\e.e\e": "ẹ" -"\e$e\e": "ẹ" -"\e.H\e": "Ḥ" -"\e$H\e": "Ḥ" -"\e.h\e": "ḥ" -"\e$h\e": "ḥ" -"\e.I\e": "Ị" -"\e$I\e": "Ị" -"\e.i\e": "ị" -"\e$i\e": "ị" -"\e.K\e": "Ḳ" -"\e$K\e": "Ḳ" -"\e.k\e": "ḳ" -"\e$k\e": "ḳ" -"\e.L\e": "Ḷ" -"\e$L\e": "Ḷ" -"\e.l\e": "ḷ" -"\e$l\e": "ḷ" -"\e.M\e": "Ṃ" -"\e$M\e": "Ṃ" -"\e.m\e": "ṃ" -"\e$m\e": "ṃ" -"\e.N\e": "Ṇ" -"\e$N\e": "Ṇ" -"\e.n\e": "ṇ" -"\e$n\e": "ṇ" -"\e.O\e": "Ọ" -"\e$O\e": "Ọ" -"\e.o\e": "ọ" -"\e$o\e": "ọ" -"\e.R\e": "Ṛ" -"\e$R\e": "Ṛ" -"\e.r\e": "ṛ" -"\e$r\e": "ṛ" -"\e.S\e": "Ṣ" -"\e$S\e": "Ṣ" -"\e.s\e": "ṣ" -"\e$s\e": "ṣ" -"\e.T\e": "Ṭ" -"\e$T\e": "Ṭ" -"\e.t\e": "ṭ" -"\e$t\e": "ṭ" -"\e.U\e": "Ụ" -"\e$U\e": "Ụ" -"\e.u\e": "ụ" -"\e$u\e": "ụ" -"\e$V\e": "Ṿ" -"\e.V\e": "Ṿ" -"\e.v\e": "ṿ" -"\e$v\e": "ṿ" -"\e.W\e": "Ẉ" -"\e$W\e": "Ẉ" -"\e.w\e": "ẉ" -"\e$w\e": "ẉ" -"\e.Y\e": "Ỵ" -"\e$Y\e": "Ỵ" -"\e.y\e": "ỵ" -"\e$y\e": "ỵ" -"\e.Z\e": "Ẓ" -"\e$Z\e": "Ẓ" -"\e.Z\e": "ẓ" -"\e$Z\e": "ẓ" -"\einf\e": "∞" -"\edeg\e": "°" -"\e&&\e": "∧" -"\eue\e": "↔" -"\ede\e": "→" +# GNU Readline input translations (no unicode here) # Things we have don't have Unicode symbols in terminal. # So we use the Mathics name diff --git a/mathicsscript/inputrc-no-unicode b/mathicsscript/inputrc-no-unicode new file mode 100644 index 0000000..469147b --- /dev/null +++ b/mathicsscript/inputrc-no-unicode @@ -0,0 +1,56 @@ +# GNU Readline input translations + +# Note: the reader will insure that the current working directory is this +# one before reading this file. Therefore we can omit path directories. +$include "inputrc" + +# Lowercase TeX Greek characters +"\e\\alpha\e": "\\[Alpha]" +"\e\\beta\e": "\\[Beta]" +"\e\\gamma\e": "\\[Gama]" +"\e\\delta\e": "\\[Delta]" +"\e\\epsilon\e": "\\[Epsilon]" +"\e\\zeta\e": "\\[Zeta]" +"\e\\eta\e": "\\[Eta]" +"\e\\theta\e": "\\[Theta]" +"\e\\iota\e": "\\[Iota]" +"\e\\kappa\e": "\\[Kappa]" +"\e\\lambda\e": "\\[Lambda]" +"\e\\mu\e": "\\[Mu]" +"\e\\nu\e": "\\[Nu]" +"\e\\xi\e": "\\[Xi]" +"\e\\omicron\e": "\\[Omicron]" +"\e\\pi\e": "\\[Pi]" +"\e\\rho\e": "\\[Rho]" +"\e\\sigma\e": "\\[Sigma]" +"\e\\tau\e": "\\[Tau]" +"\e\\upsilon\e": "\\[Upsilon\]" +"\e\\phi\e": "\\[Phi]" +"\e\\chi\e": "\\[Chi]" +"\e\\psi\e": "\\Psi]" +"\e\\omega\e": "\\[Omega]" + +# Lowercase named Greek characters +"\ea\e": "\\[Alpha]"" +"\eb\e": "\\[Beta]" +"\eg\e": "\\[Gama]" +"\ed\e": "\\[Delta]" +"\ee\e": "\\[Epsilon]" +"\ez\e": "\\[Zeta]" +"\ee\e": "\\[Nu]" +"\et\e": "\\[Theta]" +"\ei\e": "\\[Iota]" +"\ek\e": "\\[Kappa]" +"\el\e": "\\[Lambda]" +"\em\e": "\\[Mu]" +"\en\e": "\\[Nu]" +"\ex\e": "\\[Eta]" +"\eo\e": "\\[Omega]" +"\ep\e": ""\\[Pi]" +"\er\e": "\\[Rho]" +"\es\e": "\\[Sigma]" +"\et\e": "\\[Tau]" +"\eu\e": "υ" +# "\e\\phi\e": "φ" # ? +# "\e\\chi\e": "χ" # ? +# "\e\\psi\e": "ψ" # ? diff --git a/mathicsscript/inputrc-unicode b/mathicsscript/inputrc-unicode new file mode 100644 index 0000000..ff08dd7 --- /dev/null +++ b/mathicsscript/inputrc-unicode @@ -0,0 +1,154 @@ +# GNU Readline input translations + +# Note: the reader will insure that the current working directory is this +# one before reading this file. Therefore we can omit path directories. +$include "inputrc" + +# Lowercase TeX Greek characters +"\e\\alpha\e": "α" +"\e\\beta\e": "β" +"\e\\gamma\e": "γ" +"\e\\delta\e": "δ" +"\e\\epsilon\e": "ε" +"\e\\zeta\e": "ζ" +"\e\\eta\e": "η" +"\e\\theta\e": "θ" +"\e\\iota\e": "ι" +"\e\\kappa\e": "κ" +"\e\\lambda\e": "λ" +"\e\\mu\e": "μ" +"\e\\nu\e": "ν" +"\e\\xi\e": "ξ" +"\e\\omicron\e": "ο" +"\e\\pi\e": "π" +"\e\\rho\e": "ρ" +"\e\\varsigma\e": "ς" +"\e\\sigma\e": "σ" +"\e\\tau\e": "τ" +"\e\\upsilon\e": "υ" +"\e\\phi\e": "φ" +"\e\\chi\e": "χ" +"\e\\psi\e": "ψ" +"\e\\omega\e": "ω" + +# Lowercase named Greek characters +"\ea\e": "α" +"\eb\e": "β" +"\eg\e": "γ" +"\ed\e": "δ" +"\ee\e": "ε" +"\ez\e": "ζ" +"\ee\e": "η" +"\et\e": "θ" +"\ei\e": "ι" +"\ek\e": "κ" +"\el\e": "λ" +"\em\e": "μ" +"\en\e": "ν" +"\ex\e": "ξ" +"\eo\e": "ω" +"\ep\e": "π" +"\er\e": "ρ" +"\ev\e": "ς" +"\es\e": "σ" +"\et\e": "τ" +"\eu\e": "υ" +# "\e\\phi\e": "φ" # ? +# "\e\\chi\e": "χ" # ? +# "\e\\psi\e": "ψ" # ? + +# Uppercase TeX Greek symbols +"\e\\Gamma\e": "Γ" +"\e\\Delta\e": "Δ" +"\e\\Theta\e": "Θ" +"\e\\Lambda\e": "Λ" +"\e\\Xi\e": "Ξ" +"\e\\Pi\e": "Π" +"\e\\Sigma\e": "Σ" +"\e\\Upsilon\e": "Υ" +"\e\\Phi\e": "Φ" +"\e\\Psi\e": "Ψ" +"\e\\Omega\e": "Ω" + +# Things we have Unicode symbols for +"\e.a\e": "ạ" +"\e$a\e": "ạ" +"\e.A\e": "Ạ" +"\e$A\e": "Ạ" +"\e.B\e": "Ḅ" +"\e$B\e": "Ḅ" +"\e.b\e": "ḅ" +"\e$b\e": "ḅ" +"\e.D\e": "Ḍ" +"\e$D\e": "Ḍ" +"\e.d\e": "ḍ" +"\e$d\e": "ḍ" +"\e.E\e": "Ẹ" +"\e$E\e": "Ẹ" +"\e.e\e": "ẹ" +"\e$e\e": "ẹ" +"\e.H\e": "Ḥ" +"\e$H\e": "Ḥ" +"\e.h\e": "ḥ" +"\e$h\e": "ḥ" +"\e.I\e": "Ị" +"\e$I\e": "Ị" +"\e.i\e": "ị" +"\e$i\e": "ị" +"\e.K\e": "Ḳ" +"\e$K\e": "Ḳ" +"\e.k\e": "ḳ" +"\e$k\e": "ḳ" +"\e.L\e": "Ḷ" +"\e$L\e": "Ḷ" +"\e.l\e": "ḷ" +"\e$l\e": "ḷ" +"\e.M\e": "Ṃ" +"\e$M\e": "Ṃ" +"\e.m\e": "ṃ" +"\e$m\e": "ṃ" +"\e.N\e": "Ṇ" +"\e$N\e": "Ṇ" +"\e.n\e": "ṇ" +"\e$n\e": "ṇ" +"\e.O\e": "Ọ" +"\e$O\e": "Ọ" +"\e.o\e": "ọ" +"\e$o\e": "ọ" +"\e.R\e": "Ṛ" +"\e$R\e": "Ṛ" +"\e.r\e": "ṛ" +"\e$r\e": "ṛ" +"\e.S\e": "Ṣ" +"\e$S\e": "Ṣ" +"\e.s\e": "ṣ" +"\e$s\e": "ṣ" +"\e.T\e": "Ṭ" +"\e$T\e": "Ṭ" +"\e.t\e": "ṭ" +"\e$t\e": "ṭ" +"\e.U\e": "Ụ" +"\e$U\e": "Ụ" +"\e.u\e": "ụ" +"\e$u\e": "ụ" +"\e$V\e": "Ṿ" +"\e.V\e": "Ṿ" +"\e.v\e": "ṿ" +"\e$v\e": "ṿ" +"\e.W\e": "Ẉ" +"\e$W\e": "Ẉ" +"\e.w\e": "ẉ" +"\e$w\e": "ẉ" +"\e.Y\e": "Ỵ" +"\e$Y\e": "Ỵ" +"\e.y\e": "ỵ" +"\e$y\e": "ỵ" +"\e.Z\e": "Ẓ" +"\e$Z\e": "Ẓ" +"\e.Z\e": "ẓ" +"\e$Z\e": "ẓ" +"\einf\e": "∞" +"\edeg\e": "°" +"\e&&\e": "∧" +"\eue\e": "↔" +"\ede\e": "→" diff --git a/mathicsscript/termshell.py b/mathicsscript/termshell.py index ba15cfb..d4f42c5 100644 --- a/mathicsscript/termshell.py +++ b/mathicsscript/termshell.py @@ -115,7 +115,12 @@ def is_pygments_style(style): class TerminalShell(LineFeeder): def __init__( - self, definitions, style: str, want_readline: bool, want_completion: bool + self, + definitions, + style: str, + want_readline: bool, + want_completion: bool, + use_unicode: bool, ): super(TerminalShell, self).__init__("") self.input_encoding = locale.getpreferredencoding() @@ -141,8 +146,15 @@ def __init__( # set_completer_delims(RL_COMPLETER_DELIMS) set_completer_delims(RL_COMPLETER_DELIMS_WITH_BRACE) - inputrc = pathlib.Path(__file__).parent.absolute() / "inputrc" - read_init_file(inputrc) + # GNU Readling inputrc $include's paths are relative to itself, + # so chdir to its directory before reading the file. + parent_dir = pathlib.Path(__file__).parent.absolute() + with parent_dir: + inputrc = ( + "inputrc-unicode" if use_unicode else "inputrc-no-unicode" + ) + read_init_file(str(parent_dir / inputrc)) + # parse_and_bind("tab: complete") self.completion_candidates = [] @@ -192,6 +204,7 @@ def __init__( "Settings`$PygmentsShowTokens", from_python(False) ) self.definitions.set_ownvalue("Settings`$PygmentsStyle", from_python(style)) + self.definitions.set_ownvalue("Settings`$UseUnicode", from_python(use_unicode)) self.definitions.set_ownvalue( "Settings`PygmentsStylesAvailable", from_python(ALL_PYGMENTS_STYLES) ) @@ -212,6 +225,7 @@ def __init__( self.definitions.set_attribute( "Settings`PygmentsStylesAvailable", "System`Locked" ) + self.definitions.set_attribute("Settings`UseUnicode", "System`Locked") def change_pygments_style(self, style): if style == self.pygments_style: diff --git a/setup.py b/setup.py index c9ee015..d481347 100644 --- a/setup.py +++ b/setup.py @@ -63,7 +63,9 @@ def read(*rnames): version=__version__, # noqa packages=find_packages(), include_package_data=True, - package_data={"": ["inputrc", "settings/settings.m"]}, + package_data={ + "": ["inputrc", "inputrc-no-unicode", "inputrc-unicode", "settings/settings.m"] + }, install_requires=[ "Mathics3 >= 1.0", "click", diff --git a/test/test_completion.py b/test/test_completion.py index 188386d..f211465 100644 --- a/test/test_completion.py +++ b/test/test_completion.py @@ -8,7 +8,11 @@ def test_completion(): definitions = Definitions(add_builtin=True, extension_modules=[]) term = TerminalShell( - definitions=definitions, style=None, want_readline=True, want_completion=True + definitions=definitions, + style=None, + want_readline=True, + want_completion=True, + use_unicode=False, ) for prefix, completions in ( From 2759546ea46ad664d09897c8638f2dd8b9990ace Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 20 Dec 2020 14:33:53 -0500 Subject: [PATCH 2/4] Add some Script Capital letters --- mathicsscript/inputrc | 26 -------------------------- mathicsscript/inputrc-no-unicode | 27 +++++++++++++++++++++++++++ mathicsscript/inputrc-unicode | 27 +++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 26 deletions(-) diff --git a/mathicsscript/inputrc b/mathicsscript/inputrc index 0b8c3cc..118477b 100644 --- a/mathicsscript/inputrc +++ b/mathicsscript/inputrc @@ -38,30 +38,4 @@ "\escx\e": "\\[ScriptX]" "\escy\e": "\\[ScriptY]" "\escz\e": "\\[ScriptZ]" -"\escA\e": "\\[ScriptCapitalA]" -"\escB\e": "\\[ScriptCapitalB]" -"\escC\e": "\\[ScriptCapitalC]" -"\escD\e": "\\[ScriptCapitalD]" -"\escE\e": "\\[ScriptCapitalE]" -"\escF\e": "\\[ScriptCapitalF]" -"\escG\e": "\\[ScriptCapitalG]" -"\escH\e": "\\[ScriptCapitalH]" -"\escI\e": "\\[ScriptCapitalI]" -"\escJ\e": "\\[ScriptCapitalJ]" -"\escK\e": "\\[ScriptCapitalK]" -"\escL\e": "\\[ScriptCapitalL]" -"\escM\e": "\\[ScriptCapitalM]" -"\escN\e": "\\[ScriptCapitalN]" -"\escO\e": "\\[ScriptCapitalO]" -"\escP\e": "\\[ScriptCapitalP]" -"\escQ\e": "\\[ScriptCapitalQ]" -"\escR\e": "\\[ScriptCapitalR]" -"\escS\e": "\\[ScriptCapitalS]" -"\escT\e": "\\[ScriptCapitalT]" -"\escU\e": "\\[ScriptCapitalU]" -"\escV\e": "\\[ScriptCapitalV]" -"\escW\e": "\\[ScriptCapitalW]" -"\escX\e": "\\[ScriptCapitalX]" -"\esCy\e": "\\[ScriptCapitalY]" -"\esCz\e": "\\[ScriptCapitalZ]" tab: complete diff --git a/mathicsscript/inputrc-no-unicode b/mathicsscript/inputrc-no-unicode index 469147b..d8939ed 100644 --- a/mathicsscript/inputrc-no-unicode +++ b/mathicsscript/inputrc-no-unicode @@ -54,3 +54,30 @@ $include "inputrc" # "\e\\phi\e": "φ" # ? # "\e\\chi\e": "χ" # ? # "\e\\psi\e": "ψ" # ? + +"\escA\e": "\\[ScriptCapitalA]" +"\escB\e": "\\[ScriptCapitalB]" +"\escC\e": "\\[ScriptCapitalC]" +"\escD\e": "\\[ScriptCapitalD]" +"\escE\e": "\\[ScriptCapitalE]" +"\escF\e": "\\[ScriptCapitalF]" +"\escG\e": "\\[ScriptCapitalG]" +"\escH\e": "\\[ScriptCapitalH]" +"\escI\e": "\\[ScriptCapitalI]" +"\escJ\e": "\\[ScriptCapitalJ]" +"\escK\e": "\\[ScriptCapitalK]" +"\escL\e": "\\[ScriptCapitalL]" +"\escM\e": "\\[ScriptCapitalM]" +"\escN\e": "\\[ScriptCapitalN]" +"\escO\e": "\\[ScriptCapitalO]" +"\escP\e": "\\[ScriptCapitalP]" +"\escQ\e": "\\[ScriptCapitalQ]" +"\escR\e": "\\[ScriptCapitalR]" +"\escS\e": "\\[ScriptCapitalS]" +"\escT\e": "\\[ScriptCapitalT]" +"\escU\e": "\\[ScriptCapitalU]" +"\escV\e": "\\[ScriptCapitalV]" +"\escW\e": "\\[ScriptCapitalW]" +"\escX\e": "\\[ScriptCapitalX]" +"\esCy\e": "\\[ScriptCapitalY]" +"\esCz\e": "\\[ScriptCapitalZ]" diff --git a/mathicsscript/inputrc-unicode b/mathicsscript/inputrc-unicode index ff08dd7..ba55e44 100644 --- a/mathicsscript/inputrc-unicode +++ b/mathicsscript/inputrc-unicode @@ -152,3 +152,30 @@ $include "inputrc" "\e&&\e": "∧" "\eue\e": "↔" "\ede\e": "→" + +"\escA\e": "𝒜" +"\escB\e": "ℬ" +"\escC\e": "𝒞" +"\escD\e": "𝒟" +"\escE\e": "ℰ" +"\escF\e": "ℱ" +"\escG\e": "𝒢" +"\escH\e": "ℋ" +"\escI\e": "ℐ" +"\escJ\e": "𝒥" +"\escK\e": "𝒦" +"\escL\e": "\\[ScriptCapitalL]" +"\escM\e": "\\[ScriptCapitalM]" +"\escN\e": "\\[ScriptCapitalN]" +"\escO\e": "\\[ScriptCapitalO]" +"\escP\e": "\\[ScriptCapitalP]" +"\escQ\e": "\\[ScriptCapitalQ]" +"\escR\e": "\\[ScriptCapitalR]" +"\escS\e": "𝒮" +"\escT\e": "\\[ScriptCapitalT]" +"\escU\e": "\\[ScriptCapitalU]" +"\escV\e": "\\[ScriptCapitalV]" +"\escW\e": "\\[ScriptCapitalW]" +"\escX\e": "\\[ScriptCapitalX]" +"\esCy\e": "\\[ScriptCapitalY]" +"\esCz\e": "\\[ScriptCapitalZ]" From 260445a9f617a3b8e127de9eb01020ed2bdff17c Mon Sep 17 00:00:00 2001 From: rocky Date: Tue, 22 Dec 2020 08:00:07 -0500 Subject: [PATCH 3/4] Use True/False for bool options... Now that Mathics will soon be fixed. --- mathicsscript/__main__.py | 4 ++-- mathicsscript/settings.m | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mathicsscript/__main__.py b/mathicsscript/__main__.py index 0cbca4c..5ce72e3 100755 --- a/mathicsscript/__main__.py +++ b/mathicsscript/__main__.py @@ -220,10 +220,10 @@ def main( # Then, it can be changed by the settings file (in WL) # and overwritten by the command line parameter. definitions.set_ownvalue( - "Settings`$ShowFullFormInput", from_python(1 if full_form else 0) + "Settings`$ShowFullFormInput", from_python(True if full_form else False) ) definitions.set_ownvalue( - "Settings`$PygmentsShowTokens", from_python(1 if pygments_tokens else 0) + "Settings`$PygmentsShowTokens", from_python(True if pygments_tokens else False) ) shell = TerminalShell(definitions, style, readline, completion, unicode) diff --git a/mathicsscript/settings.m b/mathicsscript/settings.m index 95f3285..47b724f 100644 --- a/mathicsscript/settings.m +++ b/mathicsscript/settings.m @@ -12,9 +12,11 @@ Note this is for input entered, not the output of the evaluated result. " -Settings`$ShowFullFormInput = 0 +Settings`$ShowFullFormInput = False Settings`$PygmentsStyle::usage = "This sets the Pygments style used to colorize output. The value should be a string. The default value changes background depending on whether the terminal has a light or dark background. You can also set the color style used on the command with the ``--style`` option, or look at the variable ```Settings`PygmentsStylesAvailable```. Or it can be set in the settings.m file." -Settings`$PygmentsShowTokens::usage = "Setting this 1 will show Pygments tokenization of the output." +Settings`$PygmentsShowTokens::usage = "Setting this True will show Pygments tokenization of the output." + +Settings`$PygmentsShowTokens = False From 00e9f2eaa393cb618304d262549ee8b88bf6a4f4 Mon Sep 17 00:00:00 2001 From: rocky Date: Tue, 22 Dec 2020 08:08:06 -0500 Subject: [PATCH 4/4] Adjust settings.m ... * Adjust usage descriptions. * Add Settings`$UseUnicode. --- mathicsscript/settings.m | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mathicsscript/settings.m b/mathicsscript/settings.m index 47b724f..ac69f2a 100644 --- a/mathicsscript/settings.m +++ b/mathicsscript/settings.m @@ -7,16 +7,19 @@ (**********************************************************************) -Settings`$ShowFullFormInput::usage = "If this variable is set nonzero, mathicsscript shows the input in FullForm before evaluation. +Settings`$ShowFullFormInput::usage = "If this Boolean variable is set True, mathicsscript shows the input in FullForm before evaluation. Note this is for input entered, not the output of the evaluated result. " Settings`$ShowFullFormInput = False -Settings`$PygmentsStyle::usage = "This sets the Pygments style used to colorize output. The value should be a string. +Settings`$PygmentsStyle::usage = "This variable sets the Pygments style used to colorize output. The value should be a string. The default value changes background depending on whether the terminal has a light or dark background. You can also set the color style used on the command with the ``--style`` option, or look at the variable ```Settings`PygmentsStylesAvailable```. Or it can be set in the settings.m file." -Settings`$PygmentsShowTokens::usage = "Setting this True will show Pygments tokenization of the output." +Settings`$PygmentsShowTokens::usage = "Setting this variable True will show Pygments tokenization of the output." Settings`$PygmentsShowTokens = False + +Settings`$PygmentsStyle::usage = "This Boolean variable sets whether Unicode is used in terminal input and output." +Settings`$UseUnicode = True