add cooked override.
This commit is contained in:
parent
e6586d194c
commit
f476c92fdb
1 changed files with 25 additions and 16 deletions
|
|
@ -37,6 +37,7 @@ enum
|
||||||
Send,
|
Send,
|
||||||
Plumb,
|
Plumb,
|
||||||
Scroll,
|
Scroll,
|
||||||
|
Cooked,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ESC 0x1B
|
#define ESC 0x1B
|
||||||
|
|
@ -119,7 +120,8 @@ uint insert(Rune*, int, uint, int);
|
||||||
Rectangle scrollr; /* scroll bar rectangle */
|
Rectangle scrollr; /* scroll bar rectangle */
|
||||||
Rectangle lastsr; /* used for scroll bar */
|
Rectangle lastsr; /* used for scroll bar */
|
||||||
int holdon; /* hold mode */
|
int holdon; /* hold mode */
|
||||||
int rawon; /* raw mode */
|
int rawon(void); /* raw mode */
|
||||||
|
int cooked; /* force cooked */
|
||||||
int scrolling; /* window scrolls */
|
int scrolling; /* window scrolls */
|
||||||
int clickmsec; /* time of last click */
|
int clickmsec; /* time of last click */
|
||||||
uint clickq0; /* point of last click */
|
uint clickq0; /* point of last click */
|
||||||
|
|
@ -148,6 +150,7 @@ char *menu2str[] = {
|
||||||
"send",
|
"send",
|
||||||
"plumb",
|
"plumb",
|
||||||
"scroll",
|
"scroll",
|
||||||
|
"cooked",
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -199,10 +202,6 @@ threadmain(int argc, char *argv[])
|
||||||
case 'a': /* acme mode */
|
case 'a': /* acme mode */
|
||||||
button2exec++;
|
button2exec++;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
|
||||||
/* not clear this is useful */
|
|
||||||
rawon = 1;
|
|
||||||
break;
|
|
||||||
case 's':
|
case 's':
|
||||||
scrolling++;
|
scrolling++;
|
||||||
break;
|
break;
|
||||||
|
|
@ -604,9 +603,13 @@ void
|
||||||
domenu2(int but)
|
domenu2(int but)
|
||||||
{
|
{
|
||||||
if(scrolling)
|
if(scrolling)
|
||||||
menu2str[Scroll] = "noscroll";
|
menu2str[Scroll] = "☑ scroll";
|
||||||
else
|
else
|
||||||
menu2str[Scroll] = "scroll";
|
menu2str[Scroll] = "☐ scroll";
|
||||||
|
if(cooked)
|
||||||
|
menu2str[Cooked] = "☑ cooked";
|
||||||
|
else
|
||||||
|
menu2str[Cooked] = "☐ cooked";
|
||||||
|
|
||||||
switch(menuhit(but, mc, &menu2, nil)){
|
switch(menuhit(but, mc, &menu2, nil)){
|
||||||
case -1:
|
case -1:
|
||||||
|
|
@ -651,6 +654,9 @@ domenu2(int but)
|
||||||
case Plumb:
|
case Plumb:
|
||||||
plumb(t.q0, t.q1);
|
plumb(t.q0, t.q1);
|
||||||
break;
|
break;
|
||||||
|
case Cooked:
|
||||||
|
cooked = !cooked;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
sysfatal("bad menu item");
|
sysfatal("bad menu item");
|
||||||
}
|
}
|
||||||
|
|
@ -835,8 +841,7 @@ key(Rune r)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rawon = !isecho(sfd);
|
if(rawon() && t.q0==t.nr){
|
||||||
if(rawon && t.q0==t.nr){
|
|
||||||
addraw(&r, 1);
|
addraw(&r, 1);
|
||||||
consread();
|
consread();
|
||||||
return;
|
return;
|
||||||
|
|
@ -927,8 +932,7 @@ consready(void)
|
||||||
if(holdon)
|
if(holdon)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
rawon = !isecho(sfd);
|
if(rawon())
|
||||||
if(rawon)
|
|
||||||
return t.nraw != 0;
|
return t.nraw != 0;
|
||||||
|
|
||||||
/* look to see if there is a complete line */
|
/* look to see if there is a complete line */
|
||||||
|
|
@ -946,8 +950,9 @@ consread(void)
|
||||||
{
|
{
|
||||||
char buf[8000], *p;
|
char buf[8000], *p;
|
||||||
int c, width, n;
|
int c, width, n;
|
||||||
int s;
|
int s, raw;
|
||||||
|
|
||||||
|
raw = rawon();
|
||||||
for(;;) {
|
for(;;) {
|
||||||
if(!consready())
|
if(!consready())
|
||||||
return;
|
return;
|
||||||
|
|
@ -964,8 +969,7 @@ consread(void)
|
||||||
c = *p;
|
c = *p;
|
||||||
p += width;
|
p += width;
|
||||||
n -= width;
|
n -= width;
|
||||||
rawon = !isecho(sfd);
|
if(!raw && (c == '\n' || c == '\004' || c == '\x7F'))
|
||||||
if(!rawon && (c == '\n' || c == '\004' || c == '\x7F'))
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
n = p-buf;
|
n = p-buf;
|
||||||
|
|
@ -1260,8 +1264,7 @@ paste(Rune *r, int n, int advance)
|
||||||
{
|
{
|
||||||
Rune *rbuf;
|
Rune *rbuf;
|
||||||
|
|
||||||
rawon = !isecho(sfd);
|
if(rawon() && t.q0==t.nr){
|
||||||
if(rawon && t.q0==t.nr){
|
|
||||||
addraw(r, n);
|
addraw(r, n);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1754,3 +1757,9 @@ label(Rune *sr, int n)
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
rawon(void)
|
||||||
|
{
|
||||||
|
return !cooked && !isecho(sfd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue