• Home
  • Raw
  • Download

Lines Matching refs:TT

48   tty_jump(0, TT.rows);
59 strcpy(TT.input, initial_value); in prompt()
61 tty_jump(0, TT.rows); in prompt()
63 printf("\e[1m%s: \e[0m%s", prompt, TT.input); in prompt()
67 key = scan_key(TT.keybuf, -1); in prompt()
75 if (len > 0) TT.input[--len] = 0; in prompt()
77 while (len > 0) TT.input[--len] = 0; in prompt()
78 } else if (key >= ' ' && key < 0x7f && len < sizeof(TT.input)) { in prompt()
79 TT.input[len++] = key; in prompt()
102 tty_jump(0, TT.rows); in draw_status()
106 FLAG(r) ? " [readonly]" : "", TT.pos, TT.len); in draw_status()
107 draw_trim(line, -1, TT.cols); in draw_status()
120 yy = (TT.base+yy)*16; in draw_line()
121 if (yy+xx>=TT.len) xx = TT.len-yy; in draw_line()
123 if (yy<TT.len) { in draw_line()
124 printf("\r\e[33m%0*llx\e[0m ", TT.numlen, yy); in draw_line()
127 draw_byte(TT.data[yy+x]); in draw_line()
130 for (x=0; x<xx; x++) draw_char(TT.data[yy+x]); in draw_line()
141 for (y = 0; y<TT.rows; y++) { in draw_page()
151 char cc = TT.data[16*(TT.base+yy)+xx]; in highlight()
155 tty_jump(2+TT.numlen+3*xx, yy); in highlight()
163 tty_jump(TT.numlen+17*3+xx, yy); in highlight()
174 p = memmem(TT.data+pos, TT.len-pos, TT.search, strlen(TT.search)); in find_next()
175 if (p) TT.pos = p - TT.data; in find_next()
181 size_t len = strlen(TT.search); in find_prev()
184 if (!memcmp(TT.data+pos, TT.search, len)) { in find_prev()
185 TT.pos = pos; in find_prev()
198 TT.cols = 80; in hexedit_main()
199 TT.rows = 24; in hexedit_main()
200 terminal_size(&TT.cols, &TT.rows); in hexedit_main()
201 if (TT.rows) TT.rows--; in hexedit_main()
211 if ((TT.len = fdlength(fd))<1) error_exit("bad length"); in hexedit_main()
212 if (sizeof(long)==32 && TT.len>SIZE_MAX) TT.len = SIZE_MAX; in hexedit_main()
214 for (TT.pos = TT.len, TT.numlen = 0; TT.pos; TT.pos >>= 4, TT.numlen++); in hexedit_main()
215 TT.numlen += (4-TT.numlen)&3; in hexedit_main()
217 TT.data=xmmap(0, TT.len, PROT_READ|(PROT_WRITE*!FLAG(r)), MAP_SHARED, fd, 0); in hexedit_main()
223 if (TT.pos<0) TT.pos = 0; in hexedit_main()
224 if (TT.pos>=TT.len) TT.pos = TT.len-1; in hexedit_main()
225 x = TT.pos&15; in hexedit_main()
226 y = TT.pos/16; in hexedit_main()
228 while (y<TT.base) { in hexedit_main()
229 if (TT.base-y>(TT.rows/2)) { in hexedit_main()
230 TT.base = y; in hexedit_main()
233 TT.base--; in hexedit_main()
239 while (y>=TT.base+TT.rows) { in hexedit_main()
240 if (y-(TT.base+TT.rows)>(TT.rows/2)) { in hexedit_main()
241 TT.base = y-TT.rows-1; in hexedit_main()
244 TT.base++; in hexedit_main()
247 tty_jump(0, TT.rows-1); in hexedit_main()
248 draw_line(TT.rows-1); in hexedit_main()
252 y -= TT.base; in hexedit_main()
259 key = scan_key(TT.keybuf, -1); in hexedit_main()
264 terminal_size(&TT.cols, &TT.rows); in hexedit_main()
265 if (TT.rows) TT.rows--; in hexedit_main()
282 val = estrtol(TT.input, &s, 0); in hexedit_main()
284 if (*TT.input == '-' || *TT.input == '+') TT.pos += val; in hexedit_main()
285 else TT.pos = val; in hexedit_main()
289 if (!prompt("Find", TT.search ? TT.search : "")) continue; in hexedit_main()
292 free(TT.search); in hexedit_main()
293 TT.search = xstrdup(TT.input); in hexedit_main()
294 find_next(TT.pos); in hexedit_main()
295 } else if (TT.search && (key == ('G'-'@') || key == 'n')) { // Find next in hexedit_main()
296 if (TT.pos < TT.len) find_next(TT.pos+1); in hexedit_main()
297 } else if (TT.search && (key == ('D'-'@') || key == 'p')) { // Find previous in hexedit_main()
298 if (TT.pos > 0) find_prev(TT.pos-1); in hexedit_main()
310 ll[TT.undo] = TT.pos; in hexedit_main()
311 toybuf[(sizeof(long long)*UNDO_LEN)+TT.undo++] = TT.data[TT.pos]; in hexedit_main()
312 if (TT.undolen < UNDO_LEN) TT.undolen++; in hexedit_main()
313 TT.undo %= UNDO_LEN; in hexedit_main()
318 TT.data[TT.pos] &= 15<<(4*side); in hexedit_main()
319 TT.data[TT.pos] |= i<<(4*!side); in hexedit_main()
324 ++TT.pos; in hexedit_main()
328 if (TT.undolen) { in hexedit_main()
331 TT.undolen--; in hexedit_main()
332 if (!TT.undo) TT.undo = UNDO_LEN; in hexedit_main()
333 TT.pos = ll[--TT.undo]; in hexedit_main()
334 TT.data[TT.pos] = toybuf[sizeof(long long)*UNDO_LEN+TT.undo]; in hexedit_main()
340 if (key==KEY_UP) TT.pos -= 16; in hexedit_main()
341 else if (key==KEY_DOWN) TT.pos += 16; in hexedit_main()
343 if (TT.pos<TT.len) TT.pos++; in hexedit_main()
345 if (TT.pos>0) TT.pos--; in hexedit_main()
347 TT.pos -= 16*TT.rows; in hexedit_main()
348 if (TT.pos < 0) TT.pos = 0; in hexedit_main()
349 TT.base = TT.pos/16; in hexedit_main()
352 TT.pos += 16*TT.rows; in hexedit_main()
353 if (TT.pos > TT.len-1) TT.pos = TT.len-1; in hexedit_main()
354 TT.base = TT.pos/16; in hexedit_main()
356 } else if (key==KEY_HOME) TT.pos = TT.pos & ~0xf; in hexedit_main()
357 else if (key==KEY_END) TT.pos = TT.pos | 0xf; in hexedit_main()
358 else if (key==(KEY_CTRL|KEY_HOME)) TT.pos = 0; in hexedit_main()
359 else if (key==(KEY_CTRL|KEY_END)) TT.pos = TT.len-1; in hexedit_main()
362 munmap(TT.data, TT.len); in hexedit_main()