aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/samterm
diff options
context:
space:
mode:
authorPetter Rodhelind <petter.rodhelind@gmail.com>2017-10-25 12:32:34 +0200
committerPetter Rodhelind <petter.rodhelind@gmail.com>2017-10-25 12:32:34 +0200
commit2fac3e2c80b9c8c6e4ef9ecd8c36dc28f8863398 (patch)
treee8b80dbf72ce0177a170e27036e5ee69249d2712 /src/cmd/samterm
parent7d01a5019b1e8ad004f491c0644b6c97452f0bac (diff)
downloadplan9port-2fac3e2c80b9c8c6e4ef9ecd8c36dc28f8863398.tar.gz
plan9port-2fac3e2c80b9c8c6e4ef9ecd8c36dc28f8863398.tar.bz2
plan9port-2fac3e2c80b9c8c6e4ef9ecd8c36dc28f8863398.zip
samterm: Add line wrapping for LINESTART/LINEEND, ctrl+a and ctrl+e.
Diffstat (limited to 'src/cmd/samterm')
-rw-r--r--src/cmd/samterm/main.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/cmd/samterm/main.c b/src/cmd/samterm/main.c
index e12eb860..6ab0eedc 100644
--- a/src/cmd/samterm/main.c
+++ b/src/cmd/samterm/main.c
@@ -665,12 +665,21 @@ type(Flayer *l, int res) /* what a bloody mess this is */
center(l, t->rasp.nrunes);
}else if(c == LINESTART || c == LINEEND){
flushtyping(1);
- if(c == LINESTART)
- while(a > 0 && raspc(&t->rasp, a-1)!='\n')
- a--;
- else
- while(a < t->rasp.nrunes && raspc(&t->rasp, a)!='\n')
+ if(c == LINESTART) {
+ if (a > 0 && raspc(&t->rasp, a-1)=='\n')
+ a--;
+ else {
+ while(a > 0 && raspc(&t->rasp, a-1)!='\n')
+ a--;
+ }
+ }else{
+ if(a < t->rasp.nrunes && raspc(&t->rasp, a)=='\n')
a++;
+ else {
+ while(a < t->rasp.nrunes && raspc(&t->rasp, a)!='\n')
+ a++;
+ }
+ }
l->p0 = l->p1 = a;
for(l=t->l; l<&t->l[NL]; l++)
if(l->textfn)