From d10d7c627c6f457d5f7e19800279a4bf8636292c Mon Sep 17 00:00:00 2001 From: Eric Nielsen <4120606+ericbn@users.noreply.github.com> Date: Wed, 15 Feb 2023 13:26:29 -0500 Subject: [PATCH] Revert "Further improve check-dumpfile action accuracy" This reverts commit e47eaae2e403626932406cf6b8d312e415e5587e. --- src/stage2/29_zimfw_build_init.zsh.erb | 3 +- src/stage2/50_zimfw_check_dumpfile.zsh.erb | 35 ++++++------------ src/zimfw.zsh.erb | 2 +- zimfw.zsh | 42 +++++++--------------- 4 files changed, 25 insertions(+), 57 deletions(-) diff --git a/src/stage2/29_zimfw_build_init.zsh.erb b/src/stage2/29_zimfw_build_init.zsh.erb index 9822237..8a36e00 100644 --- a/src/stage2/29_zimfw_build_init.zsh.erb +++ b/src/stage2/29_zimfw_build_init.zsh.erb @@ -22,8 +22,7 @@ _zimfw_build_init() { fi done zpre=$'*\0' - print -R 'typeset -gr _zim_fpath=('${${_zfpaths#${~zpre}}:A}')' - if (( ${#_zfpaths} )) print 'fpath=(${_zim_fpath} ${fpath})' + if (( ${#_zfpaths} )) print 'fpath=('${${_zfpaths#${~zpre}}:A}' ${fpath})' if (( ${#zfunctions} )) print -R 'autoload -Uz -- '${zfunctions#${~zpre}} for zroot_dir in ${_zroot_dirs}; do zpre=${zroot_dir}$'\0' diff --git a/src/stage2/50_zimfw_check_dumpfile.zsh.erb b/src/stage2/50_zimfw_check_dumpfile.zsh.erb index 9779b92..290f063 100644 --- a/src/stage2/50_zimfw_check_dumpfile.zsh.erb +++ b/src/stage2/50_zimfw_check_dumpfile.zsh.erb @@ -1,34 +1,19 @@ _zimfw_check_dumpfile() { - local zdumpfile + local zdumpfile zfpath zline zstyle -s ':zim:completion' dumpfile 'zdumpfile' || zdumpfile=<%= home %>/.zcompdump if [[ -e ${zdumpfile} ]]; then - local -i zup_to_date=-1 - local zline - IFS=$' \t' read -rA zline < ${zdumpfile} || return 1 - if [[ ${zline[4]} != ${ZSH_VERSION} ]] zup_to_date=0 - if (( zup_to_date != 0 && ${+_zim_fpath} )); then - local -r zold_zim_comps=(${^_zim_fpath}/^([^_]*|*~|*.zwc(|.old))(N:t)) - local -r zpre=$'*\0' - local -r znew_zim_fpath=(${${_zfpaths#${~zpre}}:A}) - local -r znew_zim_comps=(${^znew_zim_fpath}/^([^_]*|*~|*.zwc(|.old))(N:t)) - if (( ${#zold_zim_comps} != ${#znew_zim_comps} )) zup_to_date=0 - fi - if (( zup_to_date != 0 && ${+_zim_dumpfile_fpath} )); then - local -r znew_dumpfile_comps=(${^_zim_dumpfile_fpath}/^([^_]*|*~|*.zwc(|.old))(N:t)) - if (( ${zline[2]} == ${#znew_dumpfile_comps} )); then - zup_to_date=1 + if (( ${+_zim_dumpfile_fpath} )); then + local -r zcomps=(${^_zim_dumpfile_fpath}/^([^_]*|*~|*.zwc(|.old))(N:t)) + IFS=$' \t' read -rA zline < ${zdumpfile} || return 1 + if [[ ${zline[2]} -eq ${#zcomps} && ${zline[4]} == ${ZSH_VERSION} ]]; then + _zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b Already up to date" else - zup_to_date=0 - fi - fi - case ${zup_to_date} in - -1) _zimfw_print -u2 -PR "%F{yellow}<%= warn %>%B${zdumpfile}:%b Unable to check. Initialize the completion module first." ;; - 1) _zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b Already up to date" ;; - 0) _zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b New completion configuration needs to be dumped. Will do %Bclean-dumpfile%b." _zimfw_clean_dumpfile - ;; - esac + fi + else + _zimfw_print -u2 -PR "%F{yellow}<%= warn %>%B${zdumpfile}:%b Unable to check. This only works when the completion module is initialized." + fi else _zimfw_print -PR "<%= okay %>%B${zdumpfile}:%b Not found" fi diff --git a/src/zimfw.zsh.erb b/src/zimfw.zsh.erb index 0180769..bdc7fd1 100644 --- a/src/zimfw.zsh.erb +++ b/src/zimfw.zsh.erb @@ -4,7 +4,7 @@ class Zim :clear_line, :ellipsis, :okay, :warn, :error, :done, :failed def initialize - @version = "1.11.2-SNAPSHOT" + @version = "1.11.1" @home = "${ZDOTDIR:-${HOME}}" @min_zsh_version = "5.2" # Matches {ssh,http,https,git}://{user@,}host/org/repo and {user@,}host:org/repo diff --git a/zimfw.zsh b/zimfw.zsh index 6e2288b..9f0c11c 100644 --- a/zimfw.zsh +++ b/zimfw.zsh @@ -74,8 +74,7 @@ _zimfw_build_init() { fi done zpre=$'*\0' - print -R 'typeset -gr _zim_fpath=('${${_zfpaths#${~zpre}}:A}')' - if (( ${#_zfpaths} )) print 'fpath=(${_zim_fpath} ${fpath})' + if (( ${#_zfpaths} )) print 'fpath=('${${_zfpaths#${~zpre}}:A}' ${fpath})' if (( ${#zfunctions} )) print -R 'autoload -Uz -- '${zfunctions#${~zpre}} for zroot_dir in ${_zroot_dirs}; do zpre=${zroot_dir}$'\0' @@ -403,36 +402,21 @@ _zimfw_version_check() { } _zimfw_check_dumpfile() { - local zdumpfile + local zdumpfile zfpath zline zstyle -s ':zim:completion' dumpfile 'zdumpfile' || zdumpfile=${ZDOTDIR:-${HOME}}/.zcompdump if [[ -e ${zdumpfile} ]]; then - local -i zup_to_date=-1 - local zline - IFS=$' \t' read -rA zline < ${zdumpfile} || return 1 - if [[ ${zline[4]} != ${ZSH_VERSION} ]] zup_to_date=0 - if (( zup_to_date != 0 && ${+_zim_fpath} )); then - local -r zold_zim_comps=(${^_zim_fpath}/^([^_]*|*~|*.zwc(|.old))(N:t)) - local -r zpre=$'*\0' - local -r znew_zim_fpath=(${${_zfpaths#${~zpre}}:A}) - local -r znew_zim_comps=(${^znew_zim_fpath}/^([^_]*|*~|*.zwc(|.old))(N:t)) - if (( ${#zold_zim_comps} != ${#znew_zim_comps} )) zup_to_date=0 - fi - if (( zup_to_date != 0 && ${+_zim_dumpfile_fpath} )); then - local -r znew_dumpfile_comps=(${^_zim_dumpfile_fpath}/^([^_]*|*~|*.zwc(|.old))(N:t)) - if (( ${zline[2]} == ${#znew_dumpfile_comps} )); then - zup_to_date=1 + if (( ${+_zim_dumpfile_fpath} )); then + local -r zcomps=(${^_zim_dumpfile_fpath}/^([^_]*|*~|*.zwc(|.old))(N:t)) + IFS=$' \t' read -rA zline < ${zdumpfile} || return 1 + if [[ ${zline[2]} -eq ${#zcomps} && ${zline[4]} == ${ZSH_VERSION} ]]; then + _zimfw_print -PR "%F{green})%f %B${zdumpfile}:%b Already up to date" else - zup_to_date=0 - fi - fi - case ${zup_to_date} in - -1) _zimfw_print -u2 -PR "%F{yellow}! %B${zdumpfile}:%b Unable to check. Initialize the completion module first." ;; - 1) _zimfw_print -PR "%F{green})%f %B${zdumpfile}:%b Already up to date" ;; - 0) _zimfw_print -PR "%F{green})%f %B${zdumpfile}:%b New completion configuration needs to be dumped. Will do %Bclean-dumpfile%b." _zimfw_clean_dumpfile - ;; - esac + fi + else + _zimfw_print -u2 -PR "%F{yellow}! %B${zdumpfile}:%b Unable to check. This only works when the completion module is initialized." + fi else _zimfw_print -PR "%F{green})%f %B${zdumpfile}:%b Not found" fi @@ -470,7 +454,7 @@ _zimfw_compile() { } _zimfw_info() { - print -R 'zimfw version: '${_zversion}' (built at 2023-02-07 00:18:49 UTC, previous commit is 0516435)' + print -R 'zimfw version: '${_zversion}' (built at 2023-02-04 14:46:47 UTC, previous commit is 7778e97)' print -R 'OSTYPE: '${OSTYPE} print -R 'TERM: '${TERM} print -R 'TERM_PROGRAM: '${TERM_PROGRAM} @@ -857,7 +841,7 @@ esac zimfw() { builtin emulate -L zsh -o EXTENDED_GLOB - local -r _zversion='1.11.2-SNAPSHOT' zusage="Usage: %B${0}%b [%B-q%b|%B-v%b] + local -r _zversion='1.11.1' zusage="Usage: %B${0}%b [%B-q%b|%B-v%b] Actions: %Bbuild%b Build %B${ZIM_HOME}/init.zsh%b and %B${ZIM_HOME}/login_init.zsh%b.