Skip to content
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

Make REPL indicators user-customizable #259

Closed
wants to merge 5 commits into from

Conversation

chrisbarrett
Copy link

@chrisbarrett chrisbarrett commented Dec 5, 2023

Hello, not sure if you're accepting PRs on this one, but here's some novice Rust if you'd like some! 😅


The default REPL indicator is not customizable, which can make things confusing if you happen to use the same character for your regular shell prompt.1

This PR makes makes the prompt indicator configurable, giving users a way to work around conflicts with their shell prompt. The existing prompt indicator is the default if left uncustomized.

In the example below, I've set the prompt to read gpt>.

❯ cargo run
   Compiling aichat v0.11.0 (/Users/chris/src/chrisbarrett/aichat)
    Finished dev [unoptimized + debuginfo] target(s) in 2.14s
     Running `target/debug/aichat`
Welcome to aichat 0.11.0
Type ".help" for more information.
gpt>

image

Happy to make any changes you'd like, and no sweat if you're not interested. :) Cheers publishing a helpful program!

Footnotes

  1. In particular, the pure zsh prompt uses the same character, making it difficult to tell at a glance whether you're in a shell or an aichat session if you happen to use that!

@David-Else
Copy link

Awesome, I assume it will be able to fix #260? Cheers.

@chrisbarrett
Copy link
Author

@David-Else If the problem in #260 boils down to unicode rendering issues, then yes, I think this could be a workaround. :)

@ntippie
Copy link

ntippie commented Dec 5, 2023

I'd like to add that the default character is not commonly available in most fonts:

$ echo $TERM
rxvt-unicode-256color
$ echo $LANG
en_US.UTF-8
$ fc-list ':charset=3009'     
/usr/share/fonts/noto/NotoSansTaiLe-Regular.ttf: Noto Sans Tai Le:style=Regular
/usr/share/fonts/noto/NotoSansPhags-Pa-Regular.ttf: Noto Sans Phags\-Pa:style=Regular
/usr/share/fonts/noto/NotoSansYi-Regular.ttf: Noto Sans Yi:style=Regular
/usr/share/fonts/noto/NotoSansNewTaiLue-Bold.ttf: Noto Sans New Tai Lue:style=Bold
/usr/share/fonts/noto/NotoSansMongolian-Regular.ttf: Noto Sans Mongolian:style=Regular
/usr/share/fonts/noto/NotoSansNewTaiLue-Regular.ttf: Noto Sans New Tai Lue:style=Regular
/usr/share/fonts/noto/NotoSansNewTaiLue-Medium.ttf: Noto Sans New Tai Lue,Noto Sans New Tai Lue Medium:style=Medium,Regular
$ pacman -Qqe | grep -E 'ttf|fonts'
gnu-free-fonts
noto-fonts
noto-fonts-emoji
ttf-dejavu
ttf-inconsolata
ttf-nerd-fonts-symbols
ttf-nerd-fonts-symbols-mono

As you can see I have a number of Arch font packages installed and the only fonts that have the character are fonts for Asian languages. See also #248.


The default REPL indicator is not customizable, which can make things confusing if you happen to use the same character for your regular shell prompt.
In particular, the pure zsh prompt uses the same character, making it difficult to tell at a glance whether you're in a shell or an aichat session if you happen to use that!

It's also the prompt for nushell.

@sigoden
Copy link
Owner

sigoden commented Dec 7, 2023

Repl indicator is not worth using two configuration items. #263 solved the problem.

Thanks for your contribution.

@sigoden sigoden closed this Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants