13 #define fatal sysfatal
15 typedef struct Text Text;
16 typedef struct Readbuf Readbuf;
20 /* these are chosen to use malloc()'s properties well */
21 HiWater = 640000, /* max size of history */
22 LoWater = 330000, /* min size of history after max'ed */
25 /* various geometric paramters */
28 Scrollwid = 12, /* width of scroll bar */
29 Scrollgap = 4, /* gap right of scroll bar */
44 #define SCROLLKEY Kdown
46 #define CUT 0x18 /* ctrl-x */
47 #define COPY 0x03 /* crtl-c */
48 #define PASTE 0x16 /* crtl-v */
49 #define BACKSCROLLKEY Kup
51 #define READBUFSIZE 8192
55 Frame *f; /* frame ofr terminal */
57 uint nr; /* num of runes in term */
58 Rune *r; /* runes for term */
59 uint nraw; /* num of runes in raw buffer */
60 Rune *raw; /* raw buffer */
61 uint org; /* first rune on the screen */
62 uint q0; /* start of selection region */
63 uint q1; /* end of selection region */
64 uint qh; /* unix point */
65 int npart; /* partial runes read from console */
67 int nsnarf; /* snarf buffer */
73 short n; /* # bytes in buf */
74 uchar data[READBUFSIZE]; /* data bytes */
85 void rcstart(int fd[2]);
86 void runewrite(Rune*, int);
88 void conswrite(char*, int);
91 void paste(Rune*, int, int);
92 void snarfupdate(void);
96 void setorigin(uint org, int exact);
98 uint backnl(uint, uint);
100 uint backnl(uint, uint);
101 void addraw(Rune*, int);
103 void doubleclick(uint *q0, uint *q1);
104 int clickmatch(int cl, int cr, int dir, uint *q);
105 Rune *strrune(Rune *s, Rune c);
107 Rectangle scrpos(Rectangle r, ulong p0, ulong p1, ulong tot);
110 void hostproc(void *arg);
111 void hoststart(void);
112 int getchildwd(int, char*, int);
113 void plumbstart(void);
114 void plumb(uint, uint);
115 void plumbclick(uint*, uint*);
116 int getpts(int fd[], char *slave);
118 #define runemalloc(n) malloc((n)*sizeof(Rune))
119 #define runerealloc(a, n) realloc(a, (n)*sizeof(Rune))
120 #define runemove(a, b, n) memmove(a, b, (n)*sizeof(Rune))