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

Avoid running __lp_set_prompt multiple times #824

Merged
merged 1 commit into from Mar 14, 2024

Conversation

steelman
Copy link
Contributor

@steelman steelman commented Mar 4, 2024

Unlike lp_activate lp_theme hasn't cleand PROMPT_COMMAND. Thus, __lp_set_prompt was dded each time a theme was switched. In case of a single theme switch (e.g. from the default to dotmatrix) the performance hit due to running __lp_set_prompt twice wasn't noticable. However, the second time the function was called, it didn't show the last command runtime properly even if it was longer than LP_RUNTIME_THRESHOLD.

Fixes: 3553a65 ("Add support for Bash 5.1+ PROMPT_COMMAND array")

Technical checklist:

  • code follows our shell standards:
    • the code has been copied from 3553a65
  • tests and checks have been added, ran, and their warnings fixed:
    • unit tests have been updated (see tests/test_*.sh files)
    • ran tests.sh
    • ran shellcheck.sh (requires shellcheck).
  • documentation have been updated accordingly:
    • no — this is a bugfix

Copy link
Collaborator

@Rycieos Rycieos left a comment

Choose a reason for hiding this comment

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

Thanks for the report and patch. I can confirm the bugged behavior. I made one suggestion.

liquidprompt Outdated Show resolved Hide resolved
@Rycieos Rycieos added bug bash Related to Bash specific implemetation labels Mar 4, 2024
@Rycieos Rycieos added this to the v2.2 milestone Mar 13, 2024
Unlike lp_activate lp_theme hasn't cleand PROMPT_COMMAND. Thus,
__lp_set_prompt was dded each time a theme was switched. In case of a
single theme switch (e.g. from the default to dotmatrix) the performance
hit due to running __lp_set_prompt twice wasn't noticable. However,
the second time the function was called, it didn't show the last command
runtime properly even if it was longer than LP_RUNTIME_THRESHOLD.

Fixes: 3553a65 ("Add support for Bash 5.1+ PROMPT_COMMAND array")
@Rycieos Rycieos merged commit 4112ce6 into liquidprompt:master Mar 14, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bash Related to Bash specific implemetation bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants