aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/9term
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2015-11-10 10:33:12 -0500
committerRuss Cox <rsc@google.com>2015-11-10 15:34:42 +0000
commit8db40354c5ded13fac5974de4f7cc1b7f0087d67 (patch)
treed345ac1b136ec7460963800ab0027e772edbb9d3 /src/cmd/9term
parent0d2dfbc84f42317fab5bc247355868d86613f3b0 (diff)
downloadplan9port-8db40354c5ded13fac5974de4f7cc1b7f0087d67.tar.gz
plan9port-8db40354c5ded13fac5974de4f7cc1b7f0087d67.tar.bz2
plan9port-8db40354c5ded13fac5974de4f7cc1b7f0087d67.zip
win: local \r cancellation
Change-Id: I4becec052af58c5a52b777004867eb23023b9403 Reviewed-on: https://plan9port-review.googlesource.com/1391 Reviewed-by: Russ Cox <rsc@google.com>
Diffstat (limited to 'src/cmd/9term')
-rw-r--r--src/cmd/9term/win.c15
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: