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

fix(bash/preexec): support termcap names for tput #1670

Merged
merged 2 commits into from Feb 4, 2024

Conversation

akinomyoga
Copy link
Contributor

The current implementation assumes terminfo names for the tput command, but some implementations of tput only accept termcap names. See the commit messages for the details. This PR includes refactoring/performance improvements for tpu in the second commit.

Checks

  • I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle
  • I have checked that there are no existing pull requests for the same thing

The current uses of tput specify the terminfo entry names.  However,
there are different implementations of the tput command.  There are
two ways to specify the terminal capability: terminfo and termcap
names.  Although recent implementations of tput (such as ncurses in
Linux) accepts the terminfo name, some accept both the terminfo and
termcap names, and some old implementations (such as in FreeBSD) only
accept the termcap names.

In this patch, we first attempt the terminfo name and then the termcap
name if the terminfo name fails.

Note: When both fail due to e.g. non-existent tput, we end up with
outputting nothing.  This does not cause a serious problem because it
just does not clear the previous prompts.
With the current implementation, we spwan 10 processes of the tput
command at most every time we perform `enter_accept`.  In this patch,
to reduce the delay, we separate the related code into a function and
cache the results of the tput commands.
Copy link
Member

@ellie ellie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@ellie ellie merged commit c2af6f7 into atuinsh:main Feb 4, 2024
9 checks passed
@akinomyoga akinomyoga deleted the bash-termcap branch February 4, 2024 21:06
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.

None yet

2 participants