Skip to content

Commit

Permalink
fix(timer): skip timer after running clear (ohmyzsh#12370)
Browse files Browse the repository at this point in the history
Co-authored-by: Marc Cornellà <[email protected]>
  • Loading branch information
Nbelles and mcornella authored Jun 12, 2024
1 parent 11e84bf commit 6c021fd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugins/timer/timer.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ __timer_display_timer_precmd() {
local tdiff=$((cmd_end_time - __timer_cmd_start_time))
unset __timer_cmd_start_time
if [[ -z "${TIMER_THRESHOLD}" || ${tdiff} -ge "${TIMER_THRESHOLD}" ]]; then
local last_cmd="${history[$((HISTCMD - 1))]%% *}"
if [[ "$last_cmd" != clear ]]; then
local tdiffstr=$(__timer_format_duration ${tdiff})
local cols=$((COLUMNS - ${#tdiffstr} - 1))
echo -e "\033[1A\033[${cols}C ${tdiffstr}"
fi
fi
fi
}
Expand Down

0 comments on commit 6c021fd

Please sign in to comment.