commit - e6586d194c49d2832e409967b2567def4dcceaec
commit + f476c92fdb557a41ed0b0553328533b353df8905
blob - 2b2f55397632c5c44a19e4e0862d1efbf7fb9408
blob + c43434cb9d28e162bd26782683adb1d7c11ac84a
--- src/cmd/9term/9term.c
+++ src/cmd/9term/9term.c
Send,
Plumb,
Scroll,
+ Cooked,
};
#define ESC 0x1B
Rectangle scrollr; /* scroll bar rectangle */
Rectangle lastsr; /* used for scroll bar */
int holdon; /* hold mode */
-int rawon; /* raw mode */
+int rawon(void); /* raw mode */
+int cooked; /* force cooked */
int scrolling; /* window scrolls */
int clickmsec; /* time of last click */
uint clickq0; /* point of last click */
"send",
"plumb",
"scroll",
+ "cooked",
0
};
case 'a': /* acme mode */
button2exec++;
break;
- case 'r':
- /* not clear this is useful */
- rawon = 1;
- break;
case 's':
scrolling++;
break;
domenu2(int but)
{
if(scrolling)
- menu2str[Scroll] = "noscroll";
+ menu2str[Scroll] = "☑ scroll";
else
- menu2str[Scroll] = "scroll";
+ menu2str[Scroll] = "☐ scroll";
+ if(cooked)
+ menu2str[Cooked] = "☑ cooked";
+ else
+ menu2str[Cooked] = "☐ cooked";
switch(menuhit(but, mc, &menu2, nil)){
case -1:
case Plumb:
plumb(t.q0, t.q1);
break;
+ case Cooked:
+ cooked = !cooked;
+ break;
default:
sysfatal("bad menu item");
}
return;
}
- rawon = !isecho(sfd);
- if(rawon && t.q0==t.nr){
+ if(rawon() && t.q0==t.nr){
addraw(&r, 1);
consread();
return;
if(holdon)
return 0;
- rawon = !isecho(sfd);
- if(rawon)
+ if(rawon())
return t.nraw != 0;
/* look to see if there is a complete line */
{
char buf[8000], *p;
int c, width, n;
- int s;
+ int s, raw;
+ raw = rawon();
for(;;) {
if(!consready())
return;
c = *p;
p += width;
n -= width;
- rawon = !isecho(sfd);
- if(!rawon && (c == '\n' || c == '\004' || c == '\x7F'))
+ if(!raw && (c == '\n' || c == '\004' || c == '\x7F'))
break;
}
n = p-buf;
{
Rune *rbuf;
- rawon = !isecho(sfd);
- if(rawon && t.q0==t.nr){
+ if(rawon() && t.q0==t.nr){
addraw(r, n);
return;
}
return n;
}
+int
+rawon(void)
+{
+ return !cooked && !isecho(sfd);
+}
+