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.
This commit is contained in:
Gravemind 2018-04-19 10:00:21 +00:00 committed by Chris Down
parent d82337d226
commit 95cf774b0d

View file

@ -181,9 +181,6 @@ while true; do
rm -- "${last_filename[$selection]}" rm -- "${last_filename[$selection]}"
fi fi
last_data[$selection]=$data
last_filename[$selection]=$filename
first_line=$(get_first_line "$data") first_line=$(get_first_line "$data")
debug "New clipboard entry on $selection selection: \"$first_line\"" debug "New clipboard entry on $selection selection: \"$first_line\""
@ -191,6 +188,9 @@ while true; do
cache_file_output="$(date +%s%N) $first_line" cache_file_output="$(date +%s%N) $first_line"
filename="$cache_dir/$(cksum <<< "$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. # Recover without restart if we deleted the entire clip dir.
# It's ok that this only applies to the final directory. # It's ok that this only applies to the final directory.
# shellcheck disable=SC2174 # shellcheck disable=SC2174