Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion mathicsscript/bindkeys.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ def curly_right(event):
def paren_left(event):
b = event.cli.current_buffer
b.insert_text("(")
b.insert_text(")", move_cursor=False)
if len(b.text) > 1 and b.text[-2] == "\\":
b.insert_text("\\)", move_cursor=False)
else:
b.insert_text(")", move_cursor=False)


@bindings.add(")", filter=autocomplete_on)
Expand Down
2 changes: 1 addition & 1 deletion mathicsscript/termshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def reset_lineno(self):
def feed(self):
prompt_str = self.get_in_prompt() if self.prompt else ""
result = self.read_line(prompt_str) + "\n"
if mathics_scanner.location.TRACK_LOCATIONS:
if mathics_scanner.location.TRACK_LOCATIONS and self.source_text is not None:
self.container.append(self.source_text)
if result == "\n":
return "" # end of input
Expand Down
3 changes: 2 additions & 1 deletion mathicsscript/termshell_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from mathics.core.symbols import SymbolNull
from mathics.core.systemsymbols import SymbolMessageName
from mathics_pygments.lexer import MathematicaLexer, MToken
from mathics_scanner.location import ContainerKind
from prompt_toolkit import HTML, PromptSession, print_formatted_text
from prompt_toolkit.application.current import get_app
from prompt_toolkit.enums import EditingMode
Expand Down Expand Up @@ -67,7 +68,7 @@ def __init__(
prompt: bool,
edit_mode: Optional[str],
):
super(TerminalShellCommon, self).__init__("<stdin>")
super(TerminalShellCommon, self).__init__([], ContainerKind.STREAM)
self.input_encoding = locale.getpreferredencoding()
self.lineno = 0
self.terminal_formatter = None
Expand Down
Loading