From bfd823b33025c7b5958a9d815f7762f83bc34a71 Mon Sep 17 00:00:00 2001 From: Petter Rodhelind Date: Thu, 20 Apr 2017 22:29:29 +0200 Subject: Add ^A and ^E wrap arounds for easy movement over multiple lines --- src/cmd/acme/text.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/cmd') diff --git a/src/cmd/acme/text.c b/src/cmd/acme/text.c index ec72b4a8..0452c2b1 100644 --- a/src/cmd/acme/text.c +++ b/src/cmd/acme/text.c @@ -764,11 +764,22 @@ texttype(Text *t, Rune r) nnb = 0; if(t->q0>0 && textreadc(t, t->q0-1)!='\n') nnb = textbswidth(t, 0x15); + /* if already at beginning, wrap backwards to previous line if possible */ + if (nnb == 0 && t->q0>0) { + textshow(t, t->q0-1, t->q0-1, TRUE); + return; + } textshow(t, t->q0-nnb, t->q0-nnb, TRUE); return; case 0x05: /* ^E: end of line */ typecommit(t); q0 = t->q0; + /* if already at end, wrap forward to the next line if possible */ + if (q0file->b.nc && textreadc(t, q0) == '\n') { + q0++; + textshow(t, q0, q0, TRUE); + return; + } while(q0file->b.nc && textreadc(t, q0)!='\n') q0++; textshow(t, q0, q0, TRUE); -- cgit v1.2.3