dont-cut-text.diff 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. diff --git a/st-0.8.4/st.c b/st-0.8.4/st.c
  2. index e268ffc..20c7929 100644
  3. --- a/st-0.8.4/st.c
  4. +++ b/st-0.8.4/st.c
  5. @@ -118,6 +118,7 @@ typedef struct {
  6. typedef struct {
  7. int row; /* nb row */
  8. int col; /* nb col */
  9. + int maxcol;
  10. Line *line; /* screen */
  11. Line *alt; /* alternate screen */
  12. Line hist[HISTSIZE]; /* history buffer */
  13. @@ -1300,8 +1301,8 @@ tclearregion(int x1, int y1, int x2, int y2)
  14. if (y1 > y2)
  15. temp = y1, y1 = y2, y2 = temp;
  16. - LIMIT(x1, 0, term.col-1);
  17. - LIMIT(x2, 0, term.col-1);
  18. + LIMIT(x1, 0, term.maxcol-1);
  19. + LIMIT(x2, 0, term.maxcol-1);
  20. LIMIT(y1, 0, term.row-1);
  21. LIMIT(y2, 0, term.row-1);
  22. @@ -2579,11 +2580,18 @@ void
  23. tresize(int col, int row)
  24. {
  25. int i, j;
  26. - int minrow = MIN(row, term.row);
  27. - int mincol = MIN(col, term.col);
  28. + int tmp;
  29. + int minrow, mincol;
  30. int *bp;
  31. TCursor c;
  32. + tmp = col;
  33. + if (!term.maxcol)
  34. + term.maxcol = term.col;
  35. + col = MAX(col, term.maxcol);
  36. + minrow = MIN(row, term.row);
  37. + mincol = MIN(col, term.maxcol);
  38. +
  39. if (col < 1 || row < 1) {
  40. fprintf(stderr,
  41. "tresize: error resizing to %dx%d\n", col, row);
  42. @@ -2634,17 +2642,18 @@ tresize(int col, int row)
  43. term.line[i] = xmalloc(col * sizeof(Glyph));
  44. term.alt[i] = xmalloc(col * sizeof(Glyph));
  45. }
  46. - if (col > term.col) {
  47. - bp = term.tabs + term.col;
  48. + if (col > term.maxcol) {
  49. + bp = term.tabs + term.maxcol;
  50. - memset(bp, 0, sizeof(*term.tabs) * (col - term.col));
  51. + memset(bp, 0, sizeof(*term.tabs) * (col - term.maxcol));
  52. while (--bp > term.tabs && !*bp)
  53. /* nothing */ ;
  54. for (bp += tabspaces; bp < term.tabs + col; bp += tabspaces)
  55. *bp = 1;
  56. }
  57. /* update terminal size */
  58. - term.col = col;
  59. + term.col = tmp;
  60. + term.maxcol = col;
  61. term.row = row;
  62. /* reset scrolling region */
  63. tsetscroll(0, row-1);