aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorPetter Rodhelind <petter.rodhelind@gmail.com>2017-04-20 22:29:29 +0200
committerPetter Rodhelind <petter.rodhelind@gmail.com>2017-04-20 22:29:29 +0200
commitbfd823b33025c7b5958a9d815f7762f83bc34a71 (patch)
tree7c03e93c9ed02c0de3b3b12797e63355b6593577 /src/cmd
parent1c4e181b65ebaeb8d3f6c0aef6cd3d9b668e014b (diff)
downloadplan9port-bfd823b33025c7b5958a9d815f7762f83bc34a71.tar.gz
plan9port-bfd823b33025c7b5958a9d815f7762f83bc34a71.tar.bz2
plan9port-bfd823b33025c7b5958a9d815f7762f83bc34a71.zip
Add ^A and ^E wrap arounds for easy movement over multiple lines
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/acme/text.c11
1 files changed, 11 insertions, 0 deletions
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 (q0<t->file->b.nc && textreadc(t, q0) == '\n') {
+ q0++;
+ textshow(t, q0, q0, TRUE);
+ return;
+ }
while(q0<t->file->b.nc && textreadc(t, q0)!='\n')
q0++;
textshow(t, q0, q0, TRUE);