From 1e35c5c435c4d9632875620fb8cc35ab11a1fe2f Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 15 Jun 2012 21:43:19 +0000 Subject: [PATCH] Output a just-read character _before_ reading the next byte. Causes more sensible behaviour if you've done, say, (stty -echo -icanon; cvt-utf8 -i; stty sane) in that after you type a non-ASCII character the program won't wait for the next byte before outputting it. git-svn-id: svn://svn.tartarus.org/sgt/utils@9566 cda61777-01e9-0310-a592-d414129be87e --- cvt-utf8/cvt-utf8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cvt-utf8/cvt-utf8 b/cvt-utf8/cvt-utf8 index c586347..c3ba0a3 100755 --- a/cvt-utf8/cvt-utf8 +++ b/cvt-utf8/cvt-utf8 @@ -180,12 +180,12 @@ def process_utf8(next): char.append(c) acc = (acc << 6) + (c & 0x3F) cbytes = cbytes - 1 - if not gotone: - c = next() if cbytes > 0: output(-1, char, " (incomplete sequence)") else: process_ucs(acc, char) + if not gotone: + c = next() def do(args): # Class to turn a list into a callable object that returns one -- 2.11.0