From ef589c7a2073182ba6103c5e8891d01c01742090 Mon Sep 17 00:00:00 2001 From: Nathaniel Belles Date: Sat, 20 Apr 2024 08:04:27 +0000 Subject: [PATCH] fix(timer): don't print timer when clearing terminal screen --- plugins/timer/timer.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/timer/timer.plugin.zsh b/plugins/timer/timer.plugin.zsh index b261f71c5..c299902c8 100644 --- a/plugins/timer/timer.plugin.zsh +++ b/plugins/timer/timer.plugin.zsh @@ -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=$(fc -ln -1 | awk '{print $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 }