summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2023-12-28 03:18:23 +0000
committerdavidovski <david@davidovski.xyz>2023-12-28 03:18:23 +0000
commitd1d35ea5bd005df389dc7cf501ba490be1434f2c (patch)
tree4d010797084b86495723fd9c02cb4c08a0fd15b7
parent40b306025f6d7a318a8ce8a5fb9d337f67805325 (diff)
fix accuracy to count only current line changes0.2
-rwxr-xr-xtypr.sh16
1 files changed, 5 insertions, 11 deletions
diff --git a/typr.sh b/typr.sh
index af20002..5994278 100755
--- a/typr.sh
+++ b/typr.sh
@@ -131,14 +131,16 @@ typr_update_acc () {
total_kp=$((total_kp+1))
i=0
- t="$text"
- while [ "$i" -lt "$((${#entered_text}-1))" ]; do
+ t="$current_line"
+ while [ "$i" -lt "$((${#entered_line}-1))" ]; do
i=$((i+1))
t="${t#?}" # remove first letter
done
correct_c=${t%${t#?}}
- [ "$c" = "$correct_c" ] && correct_kp=$((correct_kp+1))
+ [ "$c" = "$correct_c" ] && {
+ correct_kp=$((correct_kp+1))
+}
export correct_kp total_kp
}
@@ -258,17 +260,9 @@ typr_main () {
current_line="$(typr_get_text_line $current_line_no)"
typr_draw_text
- #fstart=$(date +%s%N)
while true; do
- # calculate performance
- #fend=$(date +%s%N)
- #
- #msperframe=$(((fend-fstart)/1000000))
- #printf "%6s" "$msperframe"
-
c="$(tty_readc)"
- #fstart=$(date +%s%N)
case "$c" in
''|'') break;;
'')