Limit number of characters displayed in "first line" dmenu selector to 500

Fixes #14.
This commit is contained in:
Chris Down 2015-08-22 13:13:26 +01:00
parent 98b959e0d9
commit 95b8cd5698

View file

@ -2,6 +2,9 @@
LC_COLLATE=C
# Some people copy/paste huge swathes of text that could slow down dmenu
line_length_limit=500
declare -A selections
ordered_selections=()
@ -10,7 +13,7 @@ files=("/tmp/clipmenu.$USER/"*)
for (( i=${#files[@]}-1; i>=0; i-- )); do
file=${files[$i]}
first_line=$(sed -n '/./{p;q}' "$file")
first_line=$(sed -n '/./{p;q}' "$file" | cut -c1-"$line_length_limit")
lines=$(wc -l "$file")
lines=${lines%% *}