Skip to content

Commit 5bc5792

Browse files
committed
Remove f5-f6 keybindings
It's too clumsy and hard to hook in.
1 parent 81bf5c0 commit 5bc5792

File tree

2 files changed

+4
-40
lines changed

2 files changed

+4
-40
lines changed

mathicsscript/bindkeys.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import pathlib
2828
import re
2929

30-
from mathicsscript.termshell import ALL_PYGMENTS_STYLES
3130
from mathicsscript.settings import definitions
3231
from mathics.session import get_settings_value
3332

@@ -147,36 +146,6 @@ def _group_autocomplete_toggle(event):
147146
app.group_autocomplete = not app.group_autocomplete
148147

149148

150-
# Add an additional key binding for toggling this flag.
151-
@bindings.add("f5")
152-
def _next_pygments_style(event):
153-
"""Set Pygments style to the next sytle in ALL_PYGMENTS_STYLE."""
154-
app = event.app
155-
156-
try:
157-
i = ALL_PYGMENTS_STYLES.index(app.pygments_style)
158-
except ValueError:
159-
pass
160-
else:
161-
i = (i + 1) % len(ALL_PYGMENTS_STYLES)
162-
app.pygments_style = ALL_PYGMENTS_STYLES[i]
163-
164-
165-
# Add an additional key binding for toggling this flag.
166-
@bindings.add("f6")
167-
def _prev_pygments_style(event):
168-
"""Set Pygments style to the previous sytle in ALL_PYGMENTS_STYLE."""
169-
app = event.app
170-
171-
try:
172-
i = ALL_PYGMENTS_STYLES.index(app.pygments_style)
173-
except ValueError:
174-
pass
175-
else:
176-
i = (i - 1) % len(ALL_PYGMENTS_STYLES)
177-
app.pygments_style = ALL_PYGMENTS_STYLES[i]
178-
179-
180149
def read_inputrc(read_init_file_fn: Callable, use_unicode: bool) -> None:
181150
"""
182151
Read GNU Readline style inputrc

mathicsscript/termshell_prompt.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ def bottom_toolbar(self):
7979
app.help_mode = False
8080

8181
if app.help_mode:
82-
return HTML(
83-
"f1: help, f3: toggle autocomplete, f4: toggle edit mode, f5: next style, f6: previous style"
84-
)
82+
return HTML("f1: help, f3: toggle autocomplete, f4: toggle edit mode")
8583

8684
# The first time around, app.group_autocomplete has not been set,
8785
# so use the value from Settings`GroupAutocomplete.
@@ -102,20 +100,19 @@ def bottom_toolbar(self):
102100
app.group_autocomplete = True
103101
self.definitions.set_ownvalue("Settings`$GroupAutocomplete", SymbolTrue)
104102

105-
app.pygments_style = self.pygments_style
106103
if self.definitions.get_ownvalue("Settings`$PygmentsStyle") is not SymbolNull:
107104
value = self.definitions.get_ownvalue(
108105
"Settings`$PygmentsStyle"
109106
).get_string_value()
110107
if value is not None and len(value) and value[0] == value[-1] == '"':
111108
value = value[1:-1]
112-
app.pygments_style = value
109+
pygments_style = value
113110
else:
114-
app.pygments_style = self.pygments_style
111+
pygments_style = self.pygments_style
115112

116113
edit_mode = "Vi" if app.editing_mode == EditingMode.VI else "Emacs"
117114
return HTML(
118-
f" mathicsscript: {__version__}, Style: {app.pygments_style}, Mode: {edit_mode}, Autobrace: {app.group_autocomplete}"
115+
f" mathicsscript: {__version__}, Style: {pygments_style}, Mode: {edit_mode}, Autobrace: {app.group_autocomplete}, f1: Help"
119116
)
120117

121118
def errmsg(self, message: str):
@@ -222,8 +219,6 @@ def read_line(self, prompt, completer=None, use_html: bool = False):
222219
if self.pygments_style != "None"
223220
else None
224221
)
225-
app = get_app()
226-
app.pygments_style = self.pygments_style
227222

228223
if completer is None:
229224
completer = self.completer

0 commit comments

Comments
 (0)