File tree Expand file tree Collapse file tree 3 files changed +7
-3
lines changed
Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,10 @@ def curly_right(event):
6464def paren_left (event ):
6565 b = event .cli .current_buffer
6666 b .insert_text ("(" )
67- b .insert_text (")" , move_cursor = False )
67+ if len (b .text ) > 1 and b .text [- 2 ] == "\\ " :
68+ b .insert_text ("\\ )" , move_cursor = False )
69+ else :
70+ b .insert_text (")" , move_cursor = False )
6871
6972
7073@bindings .add (")" , filter = autocomplete_on )
Original file line number Diff line number Diff line change @@ -278,7 +278,7 @@ def reset_lineno(self):
278278 def feed (self ):
279279 prompt_str = self .get_in_prompt () if self .prompt else ""
280280 result = self .read_line (prompt_str ) + "\n "
281- if mathics_scanner .location .TRACK_LOCATIONS :
281+ if mathics_scanner .location .TRACK_LOCATIONS and self . source_text is not None :
282282 self .container .append (self .source_text )
283283 if result == "\n " :
284284 return "" # end of input
Original file line number Diff line number Diff line change 1616from mathics .core .symbols import SymbolNull
1717from mathics .core .systemsymbols import SymbolMessageName
1818from mathics_pygments .lexer import MathematicaLexer , MToken
19+ from mathics_scanner .location import ContainerKind
1920from prompt_toolkit import HTML , PromptSession , print_formatted_text
2021from prompt_toolkit .application .current import get_app
2122from prompt_toolkit .enums import EditingMode
@@ -67,7 +68,7 @@ def __init__(
6768 prompt : bool ,
6869 edit_mode : Optional [str ],
6970 ):
70- super (TerminalShellCommon , self ).__init__ ("<stdin>" )
71+ super (TerminalShellCommon , self ).__init__ ([], ContainerKind . STREAM )
7172 self .input_encoding = locale .getpreferredencoding ()
7273 self .lineno = 0
7374 self .terminal_formatter = None
You can’t perform that action at this time.
0 commit comments