-
-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unicode Input #263
Comments
I took a quick look at this, and this doesn't seem as trivial as it might initially seem: Relevant issue: kkawakam/rustyline#593 |
If it is too hard to do tab completions I think a reasonable alternative could be to allow LaTeX math abbreviations in the REPL input which are not replaced interactively while entering them but which are replaced in a step before passing the input to the actual numbat compiler. |
It looks like it did support that at some point, because diff --git a/numbat-cli/src/completer.rs b/numbat-cli/src/completer.rs
index 572bc55..6746ee8 100644
--- a/numbat-cli/src/completer.rs
+++ b/numbat-cli/src/completer.rs
@@ -20,6 +20,16 @@ impl Completer for NumbatCompleter {
pos: usize,
_: &rustyline::Context<'_>,
) -> rustyline::Result<(usize, Vec<Self::Candidate>)> {
+ if line[..pos].ends_with("\\hbar") {
+ return Ok((
+ pos - "\\hbar".len(),
+ vec![Pair {
+ display: "ℏ".into(),
+ replacement: "ℏ".into(),
+ }],
+ ));
+ }
+
if line.starts_with("use ") {
return Ok((
0, but it does not work as expected. Maybe this is a regression in |
Oh — it works with Upstream ticket: kkawakam/rustyline#748 |
Julia has a great feature where you can input Unicode characters using LaTeX-like abbreviations. This would be great for Numbats REPLs as well. We could type
\pi<tab>
to getπ
or\hbar
to getħ
.Open questions:
The text was updated successfully, but these errors were encountered: