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
15 changes: 2 additions & 13 deletions mathicsscript/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
from mathicsscript.termshell import (
ShellEscapeException,
TerminalShell,
wl_replace_dict_esc,
wl_replace_pattern,
)

from mathicsscript.format import format_output

from mathics import replace_wl_with_unicode
from mathics.core.parser import FileLineFeeder
from mathics.core.definitions import Definitions
from mathics.core.expression import Symbol, SymbolTrue, SymbolFalse
Expand All @@ -33,16 +32,6 @@
from mathicsscript.version import __version__


def replace_wl_to_unicode(wl_input: str) -> str:
"""WL uses some non-unicode character for various things.
Replace them with the unicode equivalent.
Two known items are directed arrow and undirected arrow.
"""
return wl_replace_pattern.sub(
lambda m: wl_replace_dict_esc[re.escape(m.group(0))], wl_input
)


def ensure_settings():
home = Path.home()
base_config_dir = home / ".config"
Expand Down Expand Up @@ -339,7 +328,7 @@ def main(
current_pos = GNU_readline.get_current_history_length()
for pos in range(last_pos, current_pos - 1):
GNU_readline.remove_history_item(pos)
wl_input = replace_wl_to_unicode(source_code.rstrip())
wl_input = replace_wl_with_unicode(source_code.rstrip())
GNU_readline.add_history(wl_input)

if query is None:
Expand Down
Loading