-
Notifications
You must be signed in to change notification settings - Fork 238
fix(insert): 🐛 fixing need to hit ENTER twice on system w/o TIOCSTI in Zsh (Bash is impossible to fix) #507 #555
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
base: dev-3.2.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -460,6 +460,7 @@ void print_bash_install_code(void) | |||||
| #endif | ||||||
| ); | ||||||
| printf("\nexport HSTR_TIOCSTI=n"); | ||||||
| // note: due to Bash 'bind -x' limitations, users need to press ENTER twice on row insertion | ||||||
|
||||||
| // note: due to Bash 'bind -x' limitations, users need to press ENTER twice on row insertion | |
| printf("\n# NOTE: Due to Bash 'bind -x' limitations, you may need to press ENTER twice after inserting a line from hstr"); |
Copilot
AI
Jan 26, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The generated Zsh snippet uses echo -n to emit a sentinel to stderr. echo option handling is not portable and can vary by shell/options; use a more reliable primitive (e.g. printf %s x >&2 or zsh’s print -n -- x >&2) for the sentinel.
| "\n { HSTR_OUT=\"$( { </dev/tty hstr -- ${BUFFER}; echo -n x >&2; } 2>&1 1>&3 3>&-; )\"; } 3>&1;" | |
| "\n { HSTR_OUT=\"$( { </dev/tty hstr -- ${BUFFER}; printf %s x >&2; } 2>&1 1>&3 3>&-; )\"; } 3>&1;" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using echo -n as the sentinel here can be unreliable in zsh depending on options (e.g., BSD_ECHO/SH_ECHO) and could break the trailing-newline detection logic. Consider a more deterministic sentinel emitter so HSTR_OUT always ends with the marker exactly once.
Other Locations
man/hstr.1:235test/sh/tiotcsi-function-zsh.sh:105
🤖 Was this useful? React with 👍 or 👎
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,4 +1,19 @@ | ||||||
| #!/usr/bin/env bash | ||||||
|
||||||
| #!/usr/bin/env bash | |
| #!/usr/bin/env zsh |
Copilot
AI
Jan 26, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This invocation is missing the -- end-of-options marker (unlike the generated config and manpage). If the current BUFFER begins with a dash (e.g. -n), hstr will parse it as an option rather than a search term; add -- before ${BUFFER} here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This snippet uses
echo -nfor the stderr sentinel;echooption handling is not portable across shells/options. Prefer a reliable primitive likeprintf %s x >&2(or zsh’sprint -n -- x >&2) in the documentation example as well.