diff options
Diffstat (limited to 'src/cmd/9term')
-rw-r--r-- | src/cmd/9term/win.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/cmd/9term/win.c b/src/cmd/9term/win.c index 97ef6d87..032f9ded 100644 --- a/src/cmd/9term/win.c +++ b/src/cmd/9term/win.c @@ -483,7 +483,7 @@ int dropcr(char *p, int n) { int i; - char *w, *r; + char *w, *r, *q; r = p; w = p; @@ -494,6 +494,19 @@ dropcr(char *p, int n) w--; break; case '\r': + while(i<n-1 && *(r+1) == '\r') { + r++; + i++; + } + if(i<n && *(r+1) != '\n') { + q = r; + while(q>p && *(q-1) != '\n') + q--; + if(q > p) { + w = q; + break; + } + } *w++ = '\n'; break; default: |