From 95cf774b0d83fe61f64bebf4d65b0f69a9719330 Mon Sep 17 00:00:00 2001 From: Gravemind Date: Thu, 19 Apr 2018 10:00:21 +0000 Subject: [PATCH] Fix wrong file deleted after partial selection (#76) It was deleting the file before the partial selection because `last_filename` was saved before filename was actually ready (so was actually saving the one before the last). Fixes #75. --- clipmenud | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clipmenud b/clipmenud index 3c4d27b..4eba9ac 100755 --- a/clipmenud +++ b/clipmenud @@ -181,9 +181,6 @@ while true; do rm -- "${last_filename[$selection]}" fi - last_data[$selection]=$data - last_filename[$selection]=$filename - first_line=$(get_first_line "$data") debug "New clipboard entry on $selection selection: \"$first_line\"" @@ -191,6 +188,9 @@ while true; do cache_file_output="$(date +%s%N) $first_line" filename="$cache_dir/$(cksum <<< "$first_line")" + last_data[$selection]=$data + last_filename[$selection]=$filename + # Recover without restart if we deleted the entire clip dir. # It's ok that this only applies to the final directory. # shellcheck disable=SC2174