diff options
author | rsc <devnull@localhost> | 2004-06-09 14:01:54 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-06-09 14:01:54 +0000 |
commit | 09a5f197726c79ef7221cc6f83527c65a6bb1ca3 (patch) | |
tree | c54741043b32ada5d66e63a872a23869b3a523c4 /src/cmd/samterm | |
parent | c16f1f733b5748211db515fa19dd821065fd6fc7 (diff) | |
download | plan9port-09a5f197726c79ef7221cc6f83527c65a6bb1ca3.tar.gz plan9port-09a5f197726c79ef7221cc6f83527c65a6bb1ca3.tar.bz2 plan9port-09a5f197726c79ef7221cc6f83527c65a6bb1ca3.zip |
Buttons 4 and 5
Diffstat (limited to 'src/cmd/samterm')
-rw-r--r-- | src/cmd/samterm/main.c | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/src/cmd/samterm/main.c b/src/cmd/samterm/main.c index 07c3426a..dcc57f94 100644 --- a/src/cmd/samterm/main.c +++ b/src/cmd/samterm/main.c @@ -435,6 +435,19 @@ flushtyping(int clearesc) #define SCROLLKEY Kdown #define BACKSCROLLKEY Kup #define ESC 0x1B +#define HOMEKEY Khome +#define ENDKEY Kend +#define PAGEUP Kpgup +#define PAGEDOWN Kpgdown + +int +nontypingkey(c) +{ + return c==SCROLLKEY || c==BACKSCROLLKEY + || c==LEFTARROW || c==RIGHTARROW + || c==HOMEKEY || c==ENDKEY + || c==PAGEUP || c==PAGEDOWN; +} void type(Flayer *l, int res) /* what a bloody mess this is */ @@ -448,7 +461,7 @@ type(Flayer *l, int res) /* what a bloody mess this is */ scrollkey = 0; if(res == RKeyboard) - scrollkey = (qpeekc()==SCROLLKEY || qpeekc()==BACKSCROLLKEY); /* ICK */ + scrollkey = nontypingkey(qpeekc()); /* ICK */ if(hostlock || t->lock){ kbdblock(); @@ -463,7 +476,7 @@ type(Flayer *l, int res) /* what a bloody mess this is */ backspacing = 0; while((c = kbdchar())>0){ if(res == RKeyboard){ - if(c==SCROLLKEY || c==BACKSCROLLKEY || c==ESC) + if(nontypingkey(c) || c==ESC) break; /* backspace, ctrl-u, ctrl-w, del */ if(c=='\b' || c==0x15 || c==0x17 || c==0x7F){ @@ -491,16 +504,36 @@ type(Flayer *l, int res) /* what a bloody mess this is */ flushtyping(0); onethird(l, a); } - if(c == SCROLLKEY){ + if(c==SCROLLKEY || c==PAGEDOWN){ flushtyping(0); center(l, l->origin+l->f.nchars+1); /* backspacing immediately after outcmd(): sorry */ - }else if(c == BACKSCROLLKEY){ + }else if(c==BACKSCROLLKEY || c==PAGEUP){ flushtyping(0); a0 = l->origin-l->f.nchars; if(a0 < 0) a0 = 0; center(l, a0); + }else if(c == RIGHTARROW){ + flushtyping(0); + a0 = l->p0; + if(a0 < t->rasp.nrunes) + a0++; + flsetselect(l, a0, a0); + center(l, a0); + }else if(c == LEFTARROW){ + flushtyping(0); + a0 = l->p0; + if(a0 > 0) + a0--; + flsetselect(l, a0, a0); + center(l, a0); + }else if(c == HOMEKEY){ + flushtyping(0); + center(l, 0); + }else if(c == ENDKEY){ + flushtyping(0); + center(l, t->rasp.nrunes); }else if(backspacing && !hostlock){ if(l->f.p0>0 && a>0){ switch(c){ |