=== modified file 'kweasy.awk' --- kweasy.awk 2016-04-15 18:35:27 +0000 +++ kweasy.awk 2016-04-13 23:01:49 +0000 @@ -5,24 +5,21 @@ line=$0 while(match(line, FIND)){ line=substr(line, RSTART+RLENGTH) - matches[NR]=matches[NR] ? matches[NR] SUBSEP off + RSTART : off + RSTART - lengths[NR]=lengths[NR] ? lengths[NR] SUBSEP RLENGTH : RLENGTH off+=RSTART+RLENGTH-1 + matches[NR]=matches[NR] ? matches[NR] SUBSEP off : off } } END{ - charlen=split("asdfghjkl;qwertyuiopzxcvbnm,.123456789ASDFGHJKL:QWERTYUIOPZXCVBNM<>!@#$%^&*()", chars, "") + charlen=split("asdfghjkl;qwertyuiopzxcvbnm,.1234567890ASDFGHJKL:QWERTYUIOPZXCVBNM<>!@#$%^&*()", chars, "") charn=1 for(l=NR;l>0;l--){ if(l in matches){ delete a split(matches[l], a, SUBSEP) - delete b - split(lengths[l], b, SUBSEP) for(n in a){ - keys[chars[charn]] = l SUBSEP a[n] SUBSEP b[n] + keys[chars[charn]] = l SUBSEP a[n] access[l, n] = chars[charn] if(++charn > charlen) { break @@ -32,35 +29,29 @@ } for(l=1;l<=NR;l++){ # printf "\n%s:", l - print "" > "/dev/stderr" + print "" if(!(l in matches)) { continue } delete a split(matches[l], a, SUBSEP) - delete b - split(lengths[l], b, SUBSEP) off_pre=0 for(n in a){ off=a[n] while(off_pre "/dev/stderr" - off_pre++ - } - off+=b[n] - while(off_pre "/dev/stderr" - off_pre++ - } + printf " " + off_pre++ + } + printf "%s", access[l,n] ? access[l,n] : "▒" + off_pre++ } } - "tty-readbyte /dev/null" | getline input if(input in keys) { split(keys[input], i, SUBSEP) - printf "%s+%s-%s:%s\n", i[1], i[2], i[3], lines[i[1]] + printf "%s+%s:%s\n", i[1], i[2], lines[i[1]] printf "%s", lines[i[1]] | "plumb -a click=" i[2] " -i" } else { - printf "\nUnhandled input '%s'\n", input > "/dev/stderr" - exit 1 + printf "\nUnhandled input '%s'\n", input } } === removed file 'tty-readbyte' --- tty-readbyte 2016-04-15 18:35:27 +0000 +++ tty-readbyte 1970-01-01 00:00:00 +0000 @@ -1,5 +0,0 @@ -#!/bin/sh -s=$(stty -g) -stty raw -echo -dd bs=1 count=1 2>/dev/null -stty $s