12 #include <sys/termios.h>
17 #define fatal sysfatal
19 typedef struct Text Text;
20 typedef struct Readbuf Readbuf;
24 /* these are chosen to use malloc()'s properties well */
25 HiWater = 640000, /* max size of history */
26 LoWater = 330000, /* min size of history after max'ed */
29 /* various geometric paramters */
32 Scrollwid = 12, /* width of scroll bar */
33 Scrollgap = 4, /* gap right of scroll bar */
48 #define SCROLLKEY Kdown
50 #define CUT 0x18 /* ctrl-x */
51 #define COPY 0x03 /* crtl-c */
52 #define PASTE 0x16 /* crtl-v */
53 #define BACKSCROLLKEY Kup
55 #define READBUFSIZE 8192
59 Frame *f; /* frame ofr terminal */
61 uint nr; /* num of runes in term */
62 Rune *r; /* runes for term */
63 uint nraw; /* num of runes in raw buffer */
64 Rune *raw; /* raw buffer */
65 uint org; /* first rune on the screen */
66 uint q0; /* start of selection region */
67 uint q1; /* end of selection region */
68 uint qh; /* unix point */
69 int npart; /* partial runes read from console */
71 int nsnarf; /* snarf buffer */
77 short n; /* # bytes in buf */
78 uchar data[READBUFSIZE]; /* data bytes */
89 void rcstart(int fd[2], int, char**);
90 void runewrite(Rune*, int);
92 void conswrite(char*, int);
95 void paste(Rune*, int, int);
96 void snarfupdate(void);
100 void setorigin(uint org, int exact);
102 uint backnl(uint, uint);
104 uint backnl(uint, uint);
105 void addraw(Rune*, int);
107 void doubleclick(uint *q0, uint *q1);
108 int clickmatch(int cl, int cr, int dir, uint *q);
109 Rune *strrune(Rune *s, Rune c);
111 Rectangle scrpos(Rectangle r, ulong p0, ulong p1, ulong tot);
114 void hostproc(void *arg);
115 void hoststart(void);
116 int getchildwd(int, char*, int);
117 void plumbstart(void);
118 void plumb(uint, uint);
119 void plumbclick(uint*, uint*);
120 int getpts(int fd[], char *slave);
122 #define runemalloc(n) malloc((n)*sizeof(Rune))
123 #define runerealloc(a, n) realloc(a, (n)*sizeof(Rune))
124 #define runemove(a, b, n) memmove(a, b, (n)*sizeof(Rune))