Skip to content

Commit

Permalink
moved line counting to clipmenud (not displayed yet; refs #20)
Browse files Browse the repository at this point in the history
This causes clipmenu to load about 40 % faster.
  • Loading branch information
GSI2016 committed Jun 21, 2016
1 parent f9a7291 commit fce6871
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 0 additions & 5 deletions clipmenu
Expand Up @@ -25,11 +25,6 @@ for (( i=${#files[@]}-1; i>=0; i-- )); do
# less useful than displaying "foo (6 lines)", where "foo" is the first
# line in the entry with actionable context.
first_line=$(sed -n '/./{p;q}' "$file" | cut -c1-"$line_length_limit")
lines=$(wc -l < "$file")

if (( lines > 1 )); then
first_line+=" ($lines lines)"
fi

ordered_selections+=("$first_line")
selections[$first_line]=$file
Expand Down
2 changes: 2 additions & 0 deletions clipmenud
Expand Up @@ -47,7 +47,9 @@ while sleep "${CLIPMENUD_SLEEP:-0.5}"; do

md5=$(md5sum <<< "$data")
md5=${md5%% *}
amount_of_lines=$(echo "$data" | wc -l)
filename="$cache_dir/$(LC_ALL=C date +%F-%H-%M-%S)-$md5"
(( amount_of_lines > 1 )) && filename+=" ($amount_of_lines lines)"

last_data[$selection]=$data
last_filename[$selection]=$filename
Expand Down

0 comments on commit fce6871

Please sign in to comment.