diff options
Diffstat (limited to 'twopane.bash')
-rwxr-xr-x | twopane.bash | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/twopane.bash b/twopane.bash index 2307fc1..ff1a143 100755 --- a/twopane.bash +++ b/twopane.bash | |||
@@ -95,13 +95,43 @@ sendstream() | |||
95 | } | 95 | } |
96 | exec 200<&${SOCAT[0]} 201>&${SOCAT[1]} | 96 | exec 200<&${SOCAT[0]} 201>&${SOCAT[1]} |
97 | socat FD:100,${stty%,}!!STDOUT STDIN!!STDOUT <&200 | | 97 | socat FD:100,${stty%,}!!STDOUT STDIN!!STDOUT <&200 | |
98 | tee >(exec cat -vt >&101) >&201 | 98 | input_filter | |
99 | tee >(output_filter | soft_cursor >&101) >&201 | ||
99 | reset -I -Q -w | 100 | reset -I -Q -w |
100 | exec 200<&- 201>&- | 101 | exec 200<&- 201>&- |
101 | wait -f "$SOCAT_PID" 2>/dev/null | 102 | wait -f "$SOCAT_PID" 2>/dev/null |
102 | done | 103 | done |
103 | } | 104 | } |
104 | 105 | ||
106 | input_filter() | ||
107 | { | ||
108 | while read -N1 | ||
109 | do | ||
110 | case "$REPLY" in | ||
111 | a ) echo -n "${REPLY@U}" ;; | ||
112 | A ) echo -n "${REPLY@L}" ;; | ||
113 | * ) echo -n "$REPLY" ;; | ||
114 | esac | ||
115 | done | ||
116 | } | ||
117 | |||
118 | output_filter() | ||
119 | { | ||
120 | cat -vt | ||
121 | } | ||
122 | |||
123 | soft_cursor() | ||
124 | { | ||
125 | printf $'\033[43m \b' | ||
126 | while read -N1 | ||
127 | do | ||
128 | printf '%s' \ | ||
129 | $'\033[00m \b' \ | ||
130 | "$REPLY" \ | ||
131 | $'\033[43m \b' | ||
132 | done | ||
133 | } | ||
134 | |||
105 | save_file bashrc <<. | 135 | save_file bashrc <<. |
106 | set -f | 136 | set -f |
107 | set -b | 137 | set -b |