Skip to content

Commit 5c8c2b2

Browse files
committed
Addd f1 key and sync with release 9.0.0
1 parent b68b4a4 commit 5c8c2b2

File tree

3 files changed

+80
-38
lines changed

3 files changed

+80
-38
lines changed

NEWS.md renamed to CHANGES.rst

Lines changed: 59 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,37 @@
1+
CHANGES
2+
=======
3+
4+
9.0.0
5+
-----
6+
7+
Supports Python 3.13. Python 3.8 support dropped.
8+
9+
Track API changes in Mathics3 Scanner 9.0.0
10+
11+
Make CLI options more like wolframscript. This is an incompatible change. Single-dash long options like ``-help``, ``-file``
12+
are now accepted. Short option ``-f`` is associated with ``-file`` rather than ``--fullform``; ``-F`` is is now used for Fullform.
13+
Option ``--read`` with alias ``-r`` is now ``-code`` and short option `-c`.
14+
15+
Toggling Autobrace using f4 was fixed.
16+
You can cycle now through pygments styles up using f5 (next style) and f6 (previous style). f1 (help) now show function key
17+
bindings in bottom bar.
18+
19+
20+
Bugs
21+
++++
22+
23+
Fixed #82
24+
25+
126
8.0.0
227
-----
328

429
Jan 26, 2025
530

6-
This release tracks the API changes in the Mathics Kernel, and to support enhanged debugging
31+
This release tracks the API changes in the Mathics3 Kernel, and to support enhanged debugging
732

8-
* `--edit-mode [emacs|vi]` or was added to `mathicsscript` to specify which initial edit mode for prompt-toolkit to start in
9-
* `--post-mortem` was added `mathicsscript` to go into a trepan3k debugger on error
33+
* ``--edit-mode [emacs|vi]`` or was added to ``mathicsscript`` to specify which initial edit mode for prompt-toolkit to start in
34+
* ``--post-mortem`` was added ``mathicsscript`` to go into a trepan3k debugger on error
1035
* Add aliases for all of the 100 or so "no-meaning" operators
1136
* Allow 2D rendering from asymptote
1237
* Add/update material in README's and screencast
@@ -52,7 +77,7 @@ Aug 10, 2025
5277
* Packaging: include matplotlib in full install
5378
* Customize Asymptote configuration and add a psviewer that removes eps trash
5479
* Bump minimum Mathics core version to 4.0.0
55-
* Bug fix: Check if `self` has `session` attribute in `asy.__del__`
80+
* Bug fix: Check if ``self`` has ``session`` attribute in ``asy.__del__``
5681

5782
3.3.1
5883
-----
@@ -64,7 +89,7 @@ Aug 10, 2025
6489
-----
6590

6691
* 3D Graphics is now handled if Asymptote is installed.
67-
* ``Settings`$UseMatplotlib`` and ``Settings`$UseAsymptote`` were added. The can disable the use of matplotlib and Asymptote when those are available.
92+
* ```Settings`$UseMatplotlib``` and ```Settings`$UseAsymptote``` were added. The can disable the use of matplotlib and Asymptote when those are available.
6893

6994
3.2.1
7095
-----
@@ -76,16 +101,16 @@ Fix packaging issues and be more tolerant matplotlib errors.
76101

77102
* Many 2D plots and graphs can now be viewed via a matplotlib shell! PR #40.
78103
* In prompt-toolkit:
79-
- Better word-boundary detection for `NamedCharacters`, `Symbols`
104+
- Better word-boundary detection for ``NamedCharacters``, ``Symbols``
80105
- Include grouping start symbols "(", "{", "[" in detection
81106

82107
3.1.0
83108
-----
84109

85110
Word completion detection was improved slightly. Previously, a grouping opener like "[", "(", or "{" would prevent word completion.
86111

87-
ASCII to unicode conversion was disabled since it was flaky and turned `===` into
88-
garbage upon seeing `==`. Issue #38
112+
ASCII to unicode conversion was disabled since it was flaky and turned ``===`` into
113+
garbage upon seeing ``==`. Issue #38
89114
90115
In prompt-readline by default, inserting a "[", "(", or "{" will automatically insert the corresponding closing "]", ")", and "}".
91116
Use f3 to toggle this behavior.
@@ -102,7 +127,7 @@ We've separated prompt_readline functions into its own module separate from the
102127
The primary readline interface has been redone using the excellent [prompt-toolkit](https://pypi.org/project/prompt-toolkit/).
103128
This is pure Python code so it should be available everywhere.
104129
We still include GNU-Readline for those situations where prompt-toolkit doesn't work. Select the readline style now with the
105-
`--choice` option which can be one of `GNU`, `Prompt`, or `None`.
130+
`--choice`` option which can be one of ``GNU``, ``Prompt``, or ``None``.
106131

107132
Prompt toolkit allows us to color input as it is getting typed. It also has nicer completion facilities, and sports a bottom modeline status bar.
108133

@@ -116,14 +141,14 @@ Independent of prompt-toolkit, there better pygments colorization using [mathics
116141

117142
* There are now system setting and user settings. User settings take precedence over system settings.
118143
* String output is now shown in quotes to make it more distinguishable from symbol and unexpanded
119-
expressssion output. This does not follow how `wolframscript` works. Option `strict-wl-output` will disable this.
144+
expressssion output. This does not follow how ``wolframscript`` works. Option ``strict-wl-output`` will disable this.
120145
* Syntax and Highlighting is now done via the Python
121146
[mathics-pygments](https://pypi.org/project/mathics-pygments/)
122147
package. I think you'll find colorization more complete and
123148
useful. Expect more improvements as mathics-pygments improves.
124-
* Flag `--initfile` is now `--run` to have better conformance with `wolframscript`. In the future we hope
125-
to support support conformance with `wolfram` if the` mathicsscript` (or code underneath) is called
126-
using the name `mathics3`.
149+
* Flag ``--initfile`` is now ``--run`` to have better conformance with ``wolframscript``. In the future we hope
150+
to support support conformance with ``wolfram`` if the`` mathicsscript`` (or code underneath) is called
151+
using the name ``mathics3``.
127152

128153
2.1.2
129154
-----
@@ -143,15 +168,15 @@ the GNU Readline inputrc files from getting created properly.
143168
2.1.0
144169
-----
145170

146-
* Allow command-line flag `-c` as an alias for `--execute` (along with `-e` to be compatible with wolframscript
171+
* Allow command-line flag ``-c`` as an alias for ``--execute`` (along with ``-e`` to be compatible with wolframscript
147172
* Better compliance on Windows which are GNU readline-starved
148173
* Better unicode detection
149174
* Accept newer mathics-scanner and Mathics3 versions
150175

151176
2.0.1
152177
-----
153178

154-
* Fix `mathicsscript -f FILE` argument. See PR #26
179+
* Fix ``mathicsscript -f FILE`` argument. See PR #26
155180

156181
2.0.0
157182
-----
@@ -163,55 +188,55 @@ the GNU Readline inputrc files from getting created properly.
163188
1.1.2
164189
-----
165190

166-
* Fix ``Settings`$ShowFullForm`` now that we use Mathics supports Booleans better
191+
* Fix ```Settings`$ShowFullForm``` now that we use Mathics supports Booleans better
167192
* Show mathicsscript version on startup
168-
* Add ``Settings`MathicsScriptVersion``
193+
* Add ```Settings`MathicsScriptVersion``
169194
* Add all of the WL escape sequences
170195
* Add conversions from WL Unicode to standard Unicode
171-
* Shell escapes `!` and `!!` added
196+
* Shell escapes ``!`` and ``!!`` added
172197

173198
Incompatible changes:
174199

175-
* `-e` `--execute` is better suited for embedded use. It adds `--quiet` and shows just evaluation output as text
200+
* ``-e`` ``--execute`` is better suited for embedded use. It adds ``--quiet`` and shows just evaluation output as text
176201

177202
1.1.1
178203
-----
179204

180205
* We require Mathics3 1.1.1 for features added in that to support unicode and user-formatting
181-
* Start to support Unicode as a CLI option: `--unicode/--no-unicode`. The setting name is ``Settings`$UseUnicode``.
206+
* Start to support Unicode as a CLI option: ``--unicode/--no-unicode``. The setting name is ```Settings`$UseUnicode``.
182207
* Add a lot of Unicode symbols and the WL esc sequences. For example letters with dots under them. These are the "Formal" parameters/letters.
183208
* Handle Unicode versus WL character code mismatches, , in particular Unicode directed and undirected edges.
184-
* Support for ``PyMathics`Graph`` (to be released on PyPI soon).
209+
* Support for ```PyMathics`Graph``` (to be released on PyPI soon).
185210
* Some XDG compatibility
186-
* Toleratte MS/Windows pyreadline which doesn't handle `remove_history_item`
211+
* Toleratte MS/Windows pyreadline which doesn't handle ``remove_history_item``
187212
* Show pygments styles when an invalid one is given
188213
* Use "inkpot" for dark backgrounds and "colorful" for light backgrounds.
189-
* Add ``Settings`PygementsStylesAvailable``
190-
* Add settings.m to holds `mathicsscript`-specific definitions `Settings` and their default values. Settings include
191-
- ``Settings`$ShowFullFormInput``
192-
- ``Settings`$PygmentsStyle``
193-
- ``Settings`$PygmentsShowTokens``
194-
- ``Settings`$UseUnicode`` (also mentioned above)
214+
* Add ```Settings`PygementsStylesAvailable``
215+
* Add settings.m to holds ``mathicsscript`a`-specific definitions ``Settings`` and their default values. Settings include
216+
- ```Settings`$ShowFullFormInput``
217+
- ```Settings`$PygmentsStyle``
218+
- ```Settings`$PygmentsShowTokens``
219+
- ```Settings`$UseUnicode``` (also mentioned above)
195220

196-
A lot of code for handling graph formating is here but will eventually be moved to a backend formattting module which hasn't been written yet.
221+
A lot of code for handling graph formatting is here but will eventually be moved to a backend formatting module which hasn't been written yet.
197222

198223

199224
1.1.0
200225
-----
201226

202-
Now that Mathic3 1.1.0 is released depend on that.
227+
Now that Mathics3 1.1.0 is released depend on that.
203228

204229
Some internal preparation work was done to support changing settings inside the REPL.
205230
Not ready for release yet.
206231

207232
1.1.0 rc1
208233
---------
209234

210-
Split off from plain `mathics` script.
235+
Split off from plain ``mathics`` script.
211236

212237
* GNU Readline terminal interaction. This includes
213238
- saving command history between sessions.
214-
- variable completion, even for symbol names like `\\[Sigma]`
215-
- limited ESC keyboard input; for example *esc* ``p`` *esc* is π
216-
* Syntax highlighting using `pygments`.
239+
- variable completion, even for symbol names like ``\\[Sigma]``
240+
- limited ESC keyboard input; for example *esc* ```p``` *esc* is π
241+
* Syntax highlighting using ``pygments``.
217242
* Automatic detection of light or dark terminal background color.

mathicsscript/bindkeys.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ def _group_autocomplete_toggle(event):
150150

151151

152152
# Add an additional key binding for toggling this flag.
153-
@bindings.add("f2")
154-
def _next_pygements_style(event):
153+
@bindings.add("f5")
154+
def _next_pygments_style(event):
155155
"""Set Pygments style to the next sytle in ALL_PYGMENTS_STYLE."""
156156
app = event.app
157157

@@ -164,6 +164,21 @@ def _next_pygements_style(event):
164164
app.pygments_style = ALL_PYGMENTS_STYLES[i]
165165

166166

167+
# Add an additional key binding for toggling this flag.
168+
@bindings.add("f6")
169+
def _prev_pygments_style(event):
170+
"""Set Pygments style to the previous sytle in ALL_PYGMENTS_STYLE."""
171+
app = event.app
172+
173+
try:
174+
i = ALL_PYGMENTS_STYLES.index(app.pygments_style)
175+
except ValueError:
176+
pass
177+
else:
178+
i = (i - 1) % len(ALL_PYGMENTS_STYLES)
179+
app.pygments_style = ALL_PYGMENTS_STYLES[i]
180+
181+
167182
def read_inputrc(read_init_file_fn: Callable, use_unicode: bool) -> None:
168183
"""
169184
Read GNU Readline style inputrc

mathicsscript/termshell_prompt.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from pygments import format, highlight, lex
2727
from pygments.formatters import Terminal256Formatter
2828
from pygments.formatters.terminal import TERMINAL_COLORS
29-
from pygments.styles import get_all_styles, get_style_by_name
29+
from pygments.styles import get_style_by_name
3030
from pygments.util import ClassNotFound
3131

3232
# FIXME: __main__ shouldn't be needed. Fix term_background
@@ -165,7 +165,9 @@ def bottom_toolbar(self):
165165
app.help_mode = False
166166

167167
if app.help_mode:
168-
return HTML(f" f1: help, f2: ")
168+
return HTML(
169+
"f1: help, f3: toggle autocomplete, f4: toggle edit mode, f5: next style, f6: previous style"
170+
)
169171

170172
# The first time around, app.group_autocomplete has not been set,
171173
# so use the value from Settings`GroupAutocomplete.

0 commit comments

Comments
 (0)