Skip to content

Commit b68b4a4

Browse files
committed
WIP - add f1 key
1 parent aa3851f commit b68b4a4

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

mathicsscript/bindkeys.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
from prompt_toolkit.enums import EditingMode
2323
from prompt_toolkit.key_binding import KeyBindings
2424
from prompt_toolkit.filters import Condition
25+
from prompt_toolkit.layout import Float, FloatContainer
26+
from prompt_toolkit.widgets import Dialog, Button, Label
2527
from sys import version_info
2628
import contextlib
2729
import pathlib
@@ -120,7 +122,7 @@ def double_quotation(event):
120122
b.insert_text('"', move_cursor=False)
121123

122124

123-
# Add an additional key binding for toggling this flag.
125+
# Add an additional key binding for toggling the Edit mode flag.
124126
@bindings.add("f4")
125127
def _editor_toggle(event):
126128
"""Toggle between Emacs and Vi mode."""
@@ -132,7 +134,14 @@ def _editor_toggle(event):
132134
app.editing_mode = EditingMode.VI
133135

134136

135-
# Add an additional key binding for toggling this flag.
137+
@bindings.add("f1")
138+
def _toggle_help(event):
139+
"""Toggles bottom bar from showing help or showing information"""
140+
app = event.app
141+
app.help_mode = not app.help_mode
142+
143+
144+
# Add an additional key binding for toggling the braces completion flag.
136145
@bindings.add("f3")
137146
def _group_autocomplete_toggle(event):
138147
"""Complete braces."""

mathicsscript/termshell_prompt.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ def bottom_toolbar(self):
161161
# TODO: Figure out how allow user-customization
162162
app = get_app()
163163
edit_mode = "Vi" if app.editing_mode == EditingMode.VI else "Emacs"
164+
if not hasattr(app, "help_mode"):
165+
app.help_mode = False
166+
167+
if app.help_mode:
168+
return HTML(f" f1: help, f2: ")
164169

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

0 commit comments

Comments
 (0)