line editing from rob
This commit is contained in:
parent
2a373ea419
commit
6b6159b3a7
1 changed files with 33 additions and 9 deletions
|
|
@ -474,23 +474,35 @@ flushtyping(int clearesc)
|
||||||
typeend = -1;
|
typeend = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SCROLLKEY Kdown
|
|
||||||
#define BACKSCROLLKEY Kup
|
#define BACKSCROLLKEY Kup
|
||||||
|
#define ENDKEY Kend
|
||||||
#define ESC 0x1B
|
#define ESC 0x1B
|
||||||
#define HOMEKEY Khome
|
#define HOMEKEY Khome
|
||||||
#define ENDKEY Kend
|
|
||||||
#define PAGEUP Kpgup
|
|
||||||
#define PAGEDOWN Kpgdown
|
|
||||||
#define LEFTARROW Kleft
|
#define LEFTARROW Kleft
|
||||||
|
#define LINEEND 0x05
|
||||||
|
#define LINESTART 0x01
|
||||||
|
#define PAGEDOWN Kpgdown
|
||||||
|
#define PAGEUP Kpgup
|
||||||
#define RIGHTARROW Kright
|
#define RIGHTARROW Kright
|
||||||
|
#define SCROLLKEY Kdown
|
||||||
|
|
||||||
int
|
int
|
||||||
nontypingkey(int c)
|
nontypingkey(int c)
|
||||||
{
|
{
|
||||||
return c==SCROLLKEY || c==BACKSCROLLKEY
|
switch(c){
|
||||||
|| c==LEFTARROW || c==RIGHTARROW
|
case BACKSCROLLKEY:
|
||||||
|| c==HOMEKEY || c==ENDKEY
|
case ENDKEY:
|
||||||
|| c==PAGEUP || c==PAGEDOWN;
|
case HOMEKEY:
|
||||||
|
case LEFTARROW:
|
||||||
|
case LINEEND:
|
||||||
|
case LINESTART:
|
||||||
|
case PAGEDOWN:
|
||||||
|
case PAGEUP:
|
||||||
|
case RIGHTARROW:
|
||||||
|
case SCROLLKEY:
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -590,6 +602,18 @@ type(Flayer *l, int res) /* what a bloody mess this is */
|
||||||
}else if(c == ENDKEY){
|
}else if(c == ENDKEY){
|
||||||
flushtyping(0);
|
flushtyping(0);
|
||||||
center(l, t->rasp.nrunes);
|
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){
|
}else if(backspacing && !hostlock){
|
||||||
/* backspacing immediately after outcmd(): sorry */
|
/* backspacing immediately after outcmd(): sorry */
|
||||||
if(l->f.p0>0 && a>0){
|
if(l->f.p0>0 && a>0){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue