diff options
author | rsc <devnull@localhost> | 2005-03-18 18:09:57 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-03-18 18:09:57 +0000 |
commit | 6b6159b3a7745bae7fb9d8672cab8bbd9713ad3c (patch) | |
tree | 2b296054ac9d4a11151ec09e6cfa66375d8578dc /src/cmd/samterm | |
parent | 2a373ea419dafeed391ae37d152f06625bdb7255 (diff) | |
download | plan9port-6b6159b3a7745bae7fb9d8672cab8bbd9713ad3c.tar.gz plan9port-6b6159b3a7745bae7fb9d8672cab8bbd9713ad3c.tar.bz2 plan9port-6b6159b3a7745bae7fb9d8672cab8bbd9713ad3c.zip |
line editing from rob
Diffstat (limited to 'src/cmd/samterm')
-rw-r--r-- | src/cmd/samterm/main.c | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/src/cmd/samterm/main.c b/src/cmd/samterm/main.c index 30cdab17..79870315 100644 --- a/src/cmd/samterm/main.c +++ b/src/cmd/samterm/main.c @@ -474,23 +474,35 @@ flushtyping(int clearesc) typeend = -1; } -#define SCROLLKEY Kdown #define BACKSCROLLKEY Kup +#define ENDKEY Kend #define ESC 0x1B #define HOMEKEY Khome -#define ENDKEY Kend -#define PAGEUP Kpgup +#define LEFTARROW Kleft +#define LINEEND 0x05 +#define LINESTART 0x01 #define PAGEDOWN Kpgdown -#define LEFTARROW Kleft -#define RIGHTARROW Kright +#define PAGEUP Kpgup +#define RIGHTARROW Kright +#define SCROLLKEY Kdown int nontypingkey(int c) { - return c==SCROLLKEY || c==BACKSCROLLKEY - || c==LEFTARROW || c==RIGHTARROW - || c==HOMEKEY || c==ENDKEY - || c==PAGEUP || c==PAGEDOWN; + switch(c){ + case BACKSCROLLKEY: + case ENDKEY: + case HOMEKEY: + case LEFTARROW: + case LINEEND: + case LINESTART: + case PAGEDOWN: + case PAGEUP: + case RIGHTARROW: + case SCROLLKEY: + return 1; + } + return 0; } void @@ -590,6 +602,18 @@ type(Flayer *l, int res) /* what a bloody mess this is */ }else if(c == ENDKEY){ flushtyping(0); 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') + a++; + l->p0 = l->p1 = a; + for(l=t->l; l<&t->l[NL]; l++) + if(l->textfn) + flsetselect(l, l->p0, l->p1); }else if(backspacing && !hostlock){ /* backspacing immediately after outcmd(): sorry */ if(l->f.p0>0 && a>0){ |