display.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. /* display.c, Ait, BSD 3-Clause, Kevin Bloom, 2023,
  2. Derived from: Atto January 2017
  3. Derived from: Anthony's Editor January 93
  4. */
  5. #include "header.h"
  6. #include "util.h"
  7. #define TB_IMPL
  8. #include "termbox.h"
  9. int moving_past = FALSE;
  10. /* Reverse scan for start of logical line containing offset */
  11. point_t lnstart(buffer_t *bp, register point_t off)
  12. {
  13. register char_t *p;
  14. do
  15. p = ptr(bp, --off);
  16. while (bp->b_buf < p && *p != '\n');
  17. return (bp->b_buf < p ? ++off : 0);
  18. }
  19. /* Forward scan for start of logical line segment (corresponds to screen line) containing 'finish' */
  20. point_t segstart(buffer_t *bp, window_t *wp, point_t start, point_t finish)
  21. {
  22. char_t *p;
  23. int c = 0;
  24. point_t scan = start;
  25. while (scan < finish) {
  26. p = ptr(bp, scan);
  27. if (*p == '\n') {
  28. c = 0;
  29. start = scan + 1;
  30. } else if (wp->w_cols <= c) {
  31. c = 0;
  32. start = scan;
  33. }
  34. scan += utf8_size(*ptr(bp,scan));
  35. c += *p == '\t' ? 8 - (c & 7) : 1;
  36. }
  37. return (c < wp->w_cols ? start : finish);
  38. }
  39. /* Forward scan for start of logical line segment following 'finish' */
  40. point_t segnext(buffer_t *bp, window_t *wp, point_t start, point_t finish)
  41. {
  42. char_t *p;
  43. int c = 0;
  44. point_t scan = segstart(bp, wp, start, finish);
  45. for (;;) {
  46. p = ptr(bp, scan);
  47. if (bp->b_ebuf <= p || wp->w_cols <= c)
  48. break;
  49. scan += utf8_size(*ptr(bp,scan));
  50. if (*p == '\n')
  51. break;
  52. c += *p == '\t' ? 8 - (c & 7) : 1;
  53. }
  54. return (p < bp->b_ebuf ? scan : pos(bp, bp->b_ebuf));
  55. }
  56. /* Move up one screen line */
  57. point_t upup(buffer_t *bp, window_t *wp, point_t off)
  58. {
  59. point_t curr = lnstart(bp, off);
  60. point_t seg = segstart(bp, wp, curr, off);
  61. if(wp->w_row == wp->w_top)
  62. moving_past = TRUE;
  63. if (curr < seg)
  64. off = segstart(bp, wp, curr, seg-1);
  65. else
  66. off = segstart(bp, wp, lnstart(bp,curr-1), curr-1);
  67. return (off);
  68. }
  69. /* Move down one screen line */
  70. point_t dndn(buffer_t *bp, window_t *wp, point_t off)
  71. {
  72. if(wp->w_row == wp->w_rows - wp->w_top - 1)
  73. moving_past = TRUE;
  74. return (segnext(bp, wp, lnstart(bp,off), off));
  75. }
  76. /* Return the offset of a column on the specified line */
  77. point_t lncolumn(buffer_t *bp, point_t offset, int column)
  78. {
  79. int c = 0;
  80. char_t *p;
  81. while ((p = ptr(bp, offset)) < bp->b_ebuf && *p != '\n' && c < column) {
  82. c += *p == '\t' ? 4 : 1;
  83. offset += utf8_size(*ptr(bp,offset));
  84. }
  85. return (offset);
  86. }
  87. void display(window_t *wp, int flag)
  88. {
  89. char_t *p, z, *g;
  90. int i, j, nch, region = 0, searchlen = strlen(searchtext), b = 0, case_sense = FALSE;
  91. int trailing_whitespace = FALSE, w = 0, token_type = ID_DEFAULT, color = TB_DEFAULT;
  92. int matched = 0;
  93. buffer_t *bp = wp->w_bufp;
  94. point_t matching_bracket = -1;
  95. int prow = bp->b_row;
  96. /* find start of screen, handle scroll up off page or top of file */
  97. /* point is always within b_page and b_epage */
  98. if (bp->b_point < bp->b_page)
  99. bp->b_page = segstart(bp, wp, lnstart(bp,bp->b_point), bp->b_point);
  100. /* reframe when scrolled off bottom */
  101. if (bp->b_reframe == 1 ||
  102. (bp->b_epage <= bp->b_point && curbp->b_point != pos(curbp, curbp->b_ebuf) &&
  103. (found_point > 0 || wp->w_rows-1 == wp->w_row - wp->w_top))) {
  104. bp->b_reframe = 0;
  105. /* Find end of screen plus one. */
  106. bp->b_page = dndn(bp, wp, bp->b_point);
  107. /* if we scroll to EOF we show 1 blank line at bottom of screen */
  108. if (pos(bp, bp->b_ebuf) <= bp->b_page) {
  109. bp->b_page = pos(bp, bp->b_ebuf);
  110. i = wp->w_rows - 1;
  111. } else {
  112. i = wp->w_rows - 0;
  113. }
  114. /* Scan backwards the required number of lines. */
  115. while (0 < i--)
  116. bp->b_page = upup(bp, wp, bp->b_page);
  117. }
  118. i = wp->w_top;
  119. j = wp->w_left;
  120. bp->b_epage = bp->b_page;
  121. // TODO: make this efficient
  122. if(bp->b_keywords != NULL &&
  123. bp->b_keywords->mlc != NULL && bp->b_keywords->emlc != NULL)
  124. set_parse_state(bp, bp->b_epage); /* are we in a multline comment ? */
  125. /* paint screen from top of page until we hit maxline */
  126. while (1) {
  127. /* reached point - store the cursor position */
  128. if (bp->b_point == bp->b_epage) {
  129. bp->b_row = i;
  130. bp->b_col = j;
  131. }
  132. p = ptr(bp, bp->b_epage);
  133. nch = 1;
  134. if (wp->w_top + wp->w_rows <= i || bp->b_ebuf <= p) /* maxline */
  135. break;
  136. if(curwp == wp && found_point == -1 && is_bracket(*ptr(bp, bp->b_point), FALSE) && (z = is_bracket(*p, TRUE)) != 0) {
  137. int dir = (z == '}' || z == ']' || z == ')' || z == '>');
  138. matching_bracket = find_matching_bracket(bp, wp, dir ? -1 : 1, TRUE);
  139. }
  140. nch = utf8_size(*p);
  141. if(wp == curwp &&
  142. bp->b_mark != NOMARK &&
  143. ((bp->b_mark <= bp->b_epage &&
  144. bp->b_point > bp->b_epage) ||
  145. (bp->b_point <= bp->b_epage &&
  146. bp->b_mark > bp->b_epage))
  147. ) {
  148. region = 1;
  149. } else if(matching_bracket >= 0 && bp->b_epage == matching_bracket) {
  150. matched = 1;
  151. } else if(curwp == wp) {
  152. if(found_point > 0 &&
  153. search_dir == 1 &&
  154. found_point - searchlen <= bp->b_epage &&
  155. bp->b_epage < found_point)
  156. region = 1;
  157. else if(found_point > 0 &&
  158. search_dir == 2 &&
  159. found_point + searchlen >= bp->b_epage &&
  160. bp->b_epage > found_point)
  161. region = 1;
  162. else if(found_point > 0 && tolower(searchtext[0]) == tolower(*p) && b == 0) {
  163. if(isupper(searchtext[0]))
  164. case_sense = TRUE;
  165. while(b < searchlen) {
  166. if(isupper(searchtext[b])) {
  167. case_sense = TRUE;
  168. if(searchtext[b] == *(p+b)) {
  169. region = 1;
  170. } else {
  171. region = 0;
  172. b = 0;
  173. break;
  174. }
  175. } else if (case_sense) {
  176. if(searchtext[b] == *(p+b)) {
  177. region = 1;
  178. } else {
  179. region = 0;
  180. b = 0;
  181. break;
  182. }
  183. } else if(!case_sense && searchtext[b] == tolower(*(p+b))) {
  184. region = 1;
  185. } else {
  186. region = 0;
  187. b = 0;
  188. break;
  189. }
  190. b++;
  191. }
  192. b = b < 0 ? 0 : b - 1;
  193. } else if(b > 0) {
  194. b--;
  195. region = 1;
  196. } else {
  197. region = 0;
  198. b = 0;
  199. }
  200. }
  201. if(nch > 1) {
  202. j++;
  203. uint32_t uni;
  204. tb_utf8_char_to_unicode(&uni, (char *)p);
  205. tb_set_cell(j-1, i, uni, region ? TB_BLACK : TB_DEFAULT, region ? TB_WHITE : TB_DEFAULT);
  206. } else if(*p < 32 && *p != '\n' && *p != '\t') {
  207. char ctrl = unctrl(*p);
  208. tb_set_cell(j, i, '^', TB_RED, region ? TB_WHITE : TB_DEFAULT);
  209. tb_set_cell(j+1, i, ctrl, TB_RED, region ? TB_WHITE : TB_DEFAULT);
  210. j += 2;
  211. } else if (isprint(*p) || *p == '\t' || *p == '\n') {
  212. /* Figure out if the whitespace is trailing or not. */
  213. g = ptr(bp, bp->b_epage);
  214. while(isspace(*p) && *p != '\n' && *g != '\n' && isspace(*(g = ptr(bp, bp->b_epage + w))) && bp->b_point != bp->b_epage + w) {
  215. if(*g == '\n') {
  216. trailing_whitespace = TRUE;
  217. break;
  218. }
  219. w++;
  220. }
  221. w = 0;
  222. if(trailing_whitespace && *p != '\t') {
  223. j++;
  224. uint32_t uni;
  225. tb_utf8_char_to_unicode(&uni, (char *)p);
  226. tb_set_cell(j-1, i, uni, TB_DEFAULT, TB_RED);
  227. } else if(*p == '\t') {
  228. j += 4;
  229. for(int t = 4; t > 0; t--)
  230. tb_set_cell(j-t, i, 0x2500, TB_YELLOW, region ? TB_WHITE : TB_DEFAULT);
  231. } else {
  232. j++;
  233. uint32_t uni;
  234. tb_utf8_char_to_unicode(&uni, (char *)p);
  235. token_type = parse_text(bp, bp->b_epage);
  236. switch(token_type) {
  237. case ID_SYMBOL: {
  238. color = TB_MAGENTA;
  239. break;
  240. }
  241. case ID_DOUBLE_STRING: {
  242. color = TB_GREEN;
  243. break;
  244. }
  245. case ID_SINGLE_STRING: {
  246. color = TB_GREEN;
  247. break;
  248. }
  249. case ID_BACK_STRING: {
  250. color = TB_CYAN;
  251. break;
  252. }
  253. case ID_DIGITS: {
  254. color = TB_CYAN;
  255. break;
  256. }
  257. case ID_LINE_COMMENT: {
  258. color = TB_BLUE;
  259. break;
  260. }
  261. case ID_BLOCK_COMMENT: {
  262. color = TB_BLUE;
  263. break;
  264. }
  265. default: {
  266. color = TB_DEFAULT;
  267. break;
  268. }
  269. }
  270. int mc = matched ? TB_MAGENTA : TB_DEFAULT;
  271. mc = region ? TB_WHITE : mc;
  272. tb_set_cell(j-1, i, uni, region ? TB_BLACK : color, mc);
  273. }
  274. }
  275. trailing_whitespace = FALSE;
  276. matched = 0;
  277. if (*p == '\n' || wp->w_cols <= j - wp->w_left) {
  278. j -= wp->w_cols;
  279. if (j < wp->w_left)
  280. j = wp->w_left;
  281. ++i;
  282. }
  283. bp->b_epage = bp->b_epage + nch;
  284. }
  285. b2w(wp); /* save buffer stuff on window */
  286. modeline(wp);
  287. if (wp == curwp && flag) {
  288. dispmsg();
  289. tb_set_cursor(bp->b_col, bp->b_row); /* set cursor */
  290. }
  291. wp->w_update = FALSE;
  292. if(bp->b_row == prow && !moving_past) {
  293. bp->b_pcol = bp->b_col;
  294. wp->w_pcol = bp->b_col;
  295. }
  296. moving_past = FALSE;
  297. }
  298. void modeline(window_t *wp)
  299. {
  300. int i, k, col = wp->w_col - wp->w_left + 1;
  301. int tabs = 0, ccs = 0;
  302. char lch, mch, och;
  303. char mltemp[TEMPBUF];
  304. char *percent = NULL;
  305. char_t *p;
  306. point_t pg = lnstart(curbp, curbp->b_page),
  307. ebuf = pos(curbp, curbp->b_ebuf);
  308. float dec = 0.0, mod = 0.0;
  309. lch = (wp == curwp ? '=' : '-');
  310. mch = ((wp->w_bufp->b_flags & B_MODIFIED) ? '*' : lch);
  311. och = ((wp->w_bufp->b_flags & B_OVERWRITE) ? 'O' : lch);
  312. /* Based on the b_page, determine if you're at the top, bottom or
  313. somewhere in-between the buffer. If in-between, calculate the
  314. percentage from the bottom. We round up always because that's
  315. what Emacs does.
  316. */
  317. percent = (char *) malloc(sizeof(char *)*3);
  318. if(pg == 0) {
  319. percent = "Top";
  320. } else if(curbp->b_epage == ebuf) {
  321. percent = "Bot";
  322. } else {
  323. mod = curbp->b_page * 100 % ebuf;
  324. dec = curbp->b_page * 100.0 / ebuf;
  325. if(mod != 0)
  326. dec++;
  327. sprintf(percent, "%d%%", (int)(dec));
  328. }
  329. for(k = 0; k <= wp->w_cols; k++) {
  330. if(wp->w_bufp->b_point-k < 0) {
  331. break;
  332. }
  333. p = ptr(wp->w_bufp, wp->w_bufp->b_point-k);
  334. if(*p == '\n' && k != 0) {
  335. break;
  336. }
  337. if(*p == '\t') {
  338. tabs++;
  339. }
  340. if(*p < 32) {
  341. ccs++;
  342. }
  343. }
  344. if(k >= wp->w_cols && col != wp->w_cols) {
  345. col += wp->w_cols;
  346. }
  347. /* remove the extra spaces from the control and tab characters */
  348. if(col > 1) {
  349. col -= tabs * 3;
  350. col -= ccs;
  351. }
  352. sprintf(mltemp, "%c%c%c %s %c%c (%d,%d) %c%c %s ", lch,och,mch, wp->w_bufp->b_bname,
  353. lch, lch, wp->w_bufp->b_line, col, lch, lch, percent);
  354. addstrxy(mltemp, wp->w_left, wp->w_top + wp->w_rows, 1);
  355. for (i = strlen(mltemp); i < wp->w_cols; i++)
  356. addchxy(lch, i+wp->w_left, wp->w_top + wp->w_rows, 1);
  357. }
  358. void dispmsg()
  359. {
  360. tb_set_cursor(0, MSGLINE);
  361. if (msgflag) {
  362. addstr(msgline);
  363. msgflag = FALSE;
  364. }
  365. clrtoeol(msgline, MSGLINE);
  366. }
  367. void display_prompt_and_response(char *prompt, char *response)
  368. {
  369. char full[NAME_MAX];
  370. strcpy(full, prompt);
  371. strcat(full, response);
  372. print_to_msgline(prompt);
  373. /* if we have a value print it and go to end of it */
  374. if (response[0] != '\0')
  375. addstr(response);
  376. clrtoeol(full, MSGLINE);
  377. }
  378. void trim_window(buffer_t *bp, window_t *wp)
  379. {
  380. point_t page = bp->b_page, ebuf = pos(bp, bp->b_ebuf);
  381. int complete_line = FALSE;
  382. for(int r = 0; r < wp->w_rows; r++) {
  383. complete_line = FALSE;
  384. for(int c = 0; c < wp->w_cols; c++) {
  385. char_t *p = page >= bp->b_epage ? (char_t *)"\n" : ptr(bp, page);
  386. if(*p == '\n' || page >= bp->b_epage) {
  387. complete_line = TRUE;
  388. int x = wp->w_left + c, y = wp->w_top +r;
  389. struct tb_cell *front_wide, *back_wide;
  390. uint32_t space = page > ebuf && c == 0 ? (uint32_t)'~' : (uint32_t)' ';
  391. int fg = page > ebuf && c == 0 ? TB_CYAN : TB_DEFAULT;
  392. int bg = TB_DEFAULT;
  393. /* RESEARCH: this makes the first line of the page go blank sometime
  394. and I don't know why.
  395. */
  396. if(y > 0)
  397. cellbuf_get(&global.front, x, y, &front_wide);
  398. cellbuf_get(&global.back, x, y, &back_wide);
  399. send_attr(fg, bg);
  400. send_char(x, y, space);
  401. if(y > 0)
  402. cell_set(front_wide, &space, 1, fg, bg);
  403. cell_set(back_wide, &space, 1, fg, bg);
  404. } else {
  405. if(*p == '\t') {
  406. page++;
  407. c += 3;
  408. } else if(*p < 32) {
  409. page++;
  410. c++;
  411. } else
  412. page += utf8_size(*p);
  413. }
  414. }
  415. if(complete_line)
  416. page++;
  417. }
  418. }
  419. void update_display()
  420. {
  421. window_t *wp;
  422. buffer_t *bp;
  423. bp = curwp->w_bufp;
  424. bp->b_cpoint = bp->b_point; /* cpoint only ever set here */
  425. /* only one window */
  426. if (wheadp->w_next == NULL) {
  427. display(curwp, TRUE);
  428. trim_window(curbp, curwp);
  429. tb_present();
  430. bp->b_psize = bp->b_size;
  431. return;
  432. }
  433. display(curwp, FALSE); /* this is key, we must call our win first to get accurate page and epage etc */
  434. trim_window(curbp, curwp);
  435. if(curwp->w_left != 0)
  436. for(int i = curwp->w_top; i < curwp->w_rows+curwp->w_top+1; i++)
  437. tb_set_cell(curwp->w_left - 1, i, '|', TB_WHITE, TB_DEFAULT);
  438. /* never curwp, but same buffer in different window or update flag set*/
  439. for (wp=wheadp; wp != NULL; wp = wp->w_next) {
  440. if (wp != curwp && (wp->w_bufp == bp || wp->w_update)) {
  441. w2b(wp);
  442. for(int i = wp->w_top; i < wp->w_rows+wp->w_top+1; i++)
  443. tb_set_cell(wp->w_left - 1, i, '|', TB_WHITE, TB_DEFAULT);
  444. display(wp, FALSE);
  445. // if(wp->w_bufp == bp || wp->w_update) {
  446. trim_window(wp->w_bufp, wp);
  447. // }
  448. }
  449. }
  450. /* now display our window and buffer */
  451. w2b(curwp);
  452. dispmsg();
  453. tb_set_cursor(curwp->w_col, curwp->w_row); /* set cursor for curwp */
  454. tb_present();
  455. bp->b_psize = bp->b_size; /* now safe to save previous size for next time */
  456. }
  457. void w2b(window_t *w)
  458. {
  459. w->w_bufp->b_point = w->w_point;
  460. w->w_bufp->b_page = w->w_page;
  461. w->w_bufp->b_epage = w->w_epage;
  462. w->w_bufp->b_row = w->w_row;
  463. w->w_bufp->b_col = w->w_col;
  464. w->w_bufp->b_pcol = w->w_pcol;
  465. /* fixup pointers in other windows of the same buffer, if size of edit text changed */
  466. if (w->w_bufp->b_point > w->w_bufp->b_cpoint) {
  467. w->w_bufp->b_point += (w->w_bufp->b_size - w->w_bufp->b_psize);
  468. w->w_bufp->b_page += (w->w_bufp->b_size - w->w_bufp->b_psize);
  469. w->w_bufp->b_epage += (w->w_bufp->b_size - w->w_bufp->b_psize);
  470. }
  471. }
  472. void b2w(window_t *w)
  473. {
  474. w->w_point = w->w_bufp->b_point;
  475. w->w_page = w->w_bufp->b_page;
  476. w->w_epage = w->w_bufp->b_epage;
  477. w->w_row = w->w_bufp->b_row;
  478. w->w_col = w->w_bufp->b_col;
  479. w->w_pcol = w->w_bufp->b_pcol;
  480. w->w_bufp->b_size = (w->w_bufp->b_ebuf - w->w_bufp->b_buf) - (w->w_bufp->b_egap - w->w_bufp->b_gap);
  481. }
  482. /* flag = default answer, FALSE=n, TRUE=y */
  483. int yesno(int flag)
  484. {
  485. struct tb_event ev;
  486. tb_present();
  487. if(tb_poll_event(&ev) != TB_OK) return 0;
  488. if (ev.ch == '\r' || ev.ch == '\n')
  489. return (flag);
  490. return (tolower(ev.ch) == 'y');
  491. }
  492. char yesnomaybeso(char d)
  493. {
  494. struct tb_event ev;
  495. tb_present();
  496. if(tb_poll_event(&ev) != TB_OK) return 0;
  497. if (ev.ch == '\r' || ev.ch == '\n')
  498. return (d);
  499. return tolower(ev.ch);
  500. }
  501. void print_tb(const char *str, int x, int y, uint16_t fg, uint16_t bg)
  502. {
  503. while (*str) {
  504. uint32_t uni;
  505. str += tb_utf8_char_to_unicode(&uni, str);
  506. tb_set_cell(x, y, uni, fg, bg);
  507. x++;
  508. }
  509. }
  510. void printf_tb(int x, int y, uint16_t fg, uint16_t bg, const char *fmt, ...)
  511. {
  512. char buf[4096];
  513. va_list vl;
  514. va_start(vl, fmt);
  515. vsnprintf(buf, sizeof(buf), fmt, vl);
  516. va_end(vl);
  517. print_tb(buf, x, y, fg, bg);
  518. }
  519. void addstr(const char *str)
  520. {
  521. printf_tb(global.cursor_x, global.cursor_y, TB_DEFAULT, TB_DEFAULT, str);
  522. tb_set_cursor(global.cursor_x+strlen(str), global.cursor_y);
  523. }
  524. void addch(char c)
  525. {
  526. printf_tb(global.cursor_x, global.cursor_y, TB_DEFAULT, TB_DEFAULT, "%c", c);
  527. tb_set_cursor(global.cursor_x+1, global.cursor_y);
  528. }
  529. /*
  530. Print char at point x,y. If within the region, highlight it.
  531. */
  532. void addchxy(char c, int x, int y, int region)
  533. {
  534. int fg = region == 0 ? TB_DEFAULT : TB_BLACK;
  535. int bg = region == 0 ? TB_DEFAULT : TB_WHITE;
  536. if(c != '\n' && c != '\r')
  537. printf_tb(x, y, fg, bg, "%c", c);
  538. else
  539. printf_tb(x, y, fg, bg, " ");
  540. }
  541. void addstrxy(char *c, int x, int y, int region)
  542. {
  543. int fg = region == 0 ? TB_DEFAULT : TB_BLACK;
  544. int bg = region == 0 ? TB_DEFAULT : TB_WHITE;
  545. printf_tb(x, y, fg, bg, "%s", c);
  546. }
  547. void clrtoeol(const char *str, int line)
  548. {
  549. int l = strlen(str);
  550. int size = COLS-l;
  551. char blanks[size], entire[COLS];
  552. if(size == 0) {
  553. for(int i=0; i<size; i++) {
  554. entire[i]=' ';
  555. }
  556. printf_tb(l, line, TB_DEFAULT, TB_DEFAULT, "%s", entire);
  557. } else {
  558. for(int i=0; i<size; i++) {
  559. blanks[i]=' ';
  560. }
  561. printf_tb(l, line, TB_DEFAULT, TB_DEFAULT, "%s", blanks);
  562. }
  563. }