diff options
author | rsc <devnull@localhost> | 2005-07-18 00:01:56 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-07-18 00:01:56 +0000 |
commit | dcc0b3ca1dee27e0f8fecec5497577a2c6faddaf (patch) | |
tree | d0a2edecf84e6330c4d3840c179dcb900a121168 /src/cmd | |
parent | ac39f019494b1ae0c037cf4dd99de70ade7d9c64 (diff) | |
download | plan9port-dcc0b3ca1dee27e0f8fecec5497577a2c6faddaf.tar.gz plan9port-dcc0b3ca1dee27e0f8fecec5497577a2c6faddaf.tar.bz2 plan9port-dcc0b3ca1dee27e0f8fecec5497577a2c6faddaf.zip |
better cr handling
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/9term/9term.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/cmd/9term/9term.c b/src/cmd/9term/9term.c index b6658b2f..c18e78c1 100644 --- a/src/cmd/9term/9term.c +++ b/src/cmd/9term/9term.c @@ -1136,6 +1136,7 @@ conswrite(char *p, int n) void runewrite(Rune *r, int n) { + static int havecr; int i; uint initial; uint q0, q1; @@ -1146,8 +1147,13 @@ runewrite(Rune *r, int n) if(n == 0) return; - /* get rid of backspaces */ + /* process trailing \r from previous write */ initial = 0; + if(havecr && *r != '\r' && *r != '\n') + initial = bswidth(0x15, t.qh, 0); + havecr = 0; + + /* get rid of backspaces */ p = q = r; for(i=0; i<n; i++) { if(*p == '\b') { @@ -1167,7 +1173,8 @@ runewrite(Rune *r, int n) q--; if(q==r) initial = bswidth(0x15, t.qh, 0); - } + }else if(i == n-1) + havecr = 1; } else if(*p) *q++ = *p; p++; |