diff options
| author | Koichi Murase <myoga.murase@gmail.com> | 2024-01-02 17:29:16 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-02 08:29:16 +0000 |
| commit | d9dab6c92da773918a2c2a53509f286d2ac912f9 (patch) | |
| tree | 35c868b1ea4f561a0797b189b4bcfe850fbc77dd /docs/package-lock.json | |
| parent | docs: update logo (#1481) (diff) | |
| download | atuin-d9dab6c92da773918a2c2a53509f286d2ac912f9.zip | |
refactor(bash): refactor and optimize `__atuin_accept_line` (#1482)
* fix(bash): prefix "__atuin_" to avoid variable conflicts
Because the function "__atuin_history" executes an arbitary user
command for "enter_accept", the local variable names should be
carefully chosen. A local variable can shadow a global variable that
the user wants to use when there is a name conflict. To avoid such a
situation we try to namespace the variables used by atuin by prefixing
"__atuin_".
* fix(bash): work around "shopt -s xpg_echo"
* refactor(bash): simplify the rendering of the prompt
* perf(bash): avoid extra evaluation of PS1
* refactor(bash): count \n by wc
We can simply use "wc -l" to count the number of newline characters.
In the POSIX standard, a line in a text stream is defined as
characters terminated by a newline character, so the unterminated line
is not counted by "wc -l". As a result, "wc -l" actually counts the
number of newline characters.
* refactor(bash): rename localvar `HISTORY => __atuin_command`
This patch renames the local variable `HISTORY` in __atuin_accept_line
to `__atuin_command`. The name of the global variable `HISTORY` set
by `__atuin_history` is kept.
Diffstat (limited to 'docs/package-lock.json')
0 files changed, 0 insertions, 0 deletions
