reflow patch
note - non-invasive, other patches, like externalpipe, not affected
This commit is contained in:
parent
8c2b1f2271
commit
ed9fc99bbc
67
patches/st-nimaipatel-reflow.diff
Normal file
67
patches/st-nimaipatel-reflow.diff
Normal file
@ -0,0 +1,67 @@
|
||||
diff --git a/st-0.8.4/st.c b/st-0.8.4/st.c
|
||||
index e268ffc..20c7929 100644
|
||||
--- a/st-0.8.4/st.c
|
||||
+++ b/st-0.8.4/st.c
|
||||
@@ -118,6 +118,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
int row; /* nb row */
|
||||
int col; /* nb col */
|
||||
+ int maxcol;
|
||||
Line *line; /* screen */
|
||||
Line *alt; /* alternate screen */
|
||||
Line hist[HISTSIZE]; /* history buffer */
|
||||
@@ -1300,8 +1301,8 @@ tclearregion(int x1, int y1, int x2, int y2)
|
||||
if (y1 > y2)
|
||||
temp = y1, y1 = y2, y2 = temp;
|
||||
|
||||
- LIMIT(x1, 0, term.col-1);
|
||||
- LIMIT(x2, 0, term.col-1);
|
||||
+ LIMIT(x1, 0, term.maxcol-1);
|
||||
+ LIMIT(x2, 0, term.maxcol-1);
|
||||
LIMIT(y1, 0, term.row-1);
|
||||
LIMIT(y2, 0, term.row-1);
|
||||
|
||||
@@ -2579,11 +2580,18 @@ void
|
||||
tresize(int col, int row)
|
||||
{
|
||||
int i, j;
|
||||
- int minrow = MIN(row, term.row);
|
||||
- int mincol = MIN(col, term.col);
|
||||
+ int tmp;
|
||||
+ int minrow, mincol;
|
||||
int *bp;
|
||||
TCursor c;
|
||||
|
||||
+ tmp = col;
|
||||
+ if (!term.maxcol)
|
||||
+ term.maxcol = term.col;
|
||||
+ col = MAX(col, term.maxcol);
|
||||
+ minrow = MIN(row, term.row);
|
||||
+ mincol = MIN(col, term.maxcol);
|
||||
+
|
||||
if (col < 1 || row < 1) {
|
||||
fprintf(stderr,
|
||||
"tresize: error resizing to %dx%d\n", col, row);
|
||||
@@ -2634,17 +2642,18 @@ tresize(int col, int row)
|
||||
term.line[i] = xmalloc(col * sizeof(Glyph));
|
||||
term.alt[i] = xmalloc(col * sizeof(Glyph));
|
||||
}
|
||||
- if (col > term.col) {
|
||||
- bp = term.tabs + term.col;
|
||||
+ if (col > term.maxcol) {
|
||||
+ bp = term.tabs + term.maxcol;
|
||||
|
||||
- memset(bp, 0, sizeof(*term.tabs) * (col - term.col));
|
||||
+ memset(bp, 0, sizeof(*term.tabs) * (col - term.maxcol));
|
||||
while (--bp > term.tabs && !*bp)
|
||||
/* nothing */ ;
|
||||
for (bp += tabspaces; bp < term.tabs + col; bp += tabspaces)
|
||||
*bp = 1;
|
||||
}
|
||||
/* update terminal size */
|
||||
- term.col = col;
|
||||
+ term.col = tmp;
|
||||
+ term.maxcol = col;
|
||||
term.row = row;
|
||||
/* reset scrolling region */
|
||||
tsetscroll(0, row-1);
|
25
st.c
25
st.c
@ -117,6 +117,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
int row; /* nb row */
|
||||
int col; /* nb col */
|
||||
int maxcol;
|
||||
Line *line; /* screen */
|
||||
Line *alt; /* alternate screen */
|
||||
Line hist[HISTSIZE]; /* history buffer */
|
||||
@ -1296,8 +1297,8 @@ tclearregion(int x1, int y1, int x2, int y2)
|
||||
if (y1 > y2)
|
||||
temp = y1, y1 = y2, y2 = temp;
|
||||
|
||||
LIMIT(x1, 0, term.col-1);
|
||||
LIMIT(x2, 0, term.col-1);
|
||||
LIMIT(x1, 0, term.maxcol-1);
|
||||
LIMIT(x2, 0, term.maxcol-1);
|
||||
LIMIT(y1, 0, term.row-1);
|
||||
LIMIT(y2, 0, term.row-1);
|
||||
|
||||
@ -2645,11 +2646,18 @@ void
|
||||
tresize(int col, int row)
|
||||
{
|
||||
int i, j;
|
||||
int minrow = MIN(row, term.row);
|
||||
int mincol = MIN(col, term.col);
|
||||
int tmp;
|
||||
int minrow, mincol;
|
||||
int *bp;
|
||||
TCursor c;
|
||||
|
||||
tmp = col;
|
||||
if (!term.maxcol)
|
||||
term.maxcol = term.col;
|
||||
col = MAX(col, term.maxcol);
|
||||
minrow = MIN(row, term.row);
|
||||
mincol = MIN(col, term.maxcol);
|
||||
|
||||
if (col < 1 || row < 1) {
|
||||
fprintf(stderr,
|
||||
"tresize: error resizing to %dx%d\n", col, row);
|
||||
@ -2700,17 +2708,18 @@ tresize(int col, int row)
|
||||
term.line[i] = xmalloc(col * sizeof(Glyph));
|
||||
term.alt[i] = xmalloc(col * sizeof(Glyph));
|
||||
}
|
||||
if (col > term.col) {
|
||||
bp = term.tabs + term.col;
|
||||
if (col > term.maxcol) {
|
||||
bp = term.tabs + term.maxcol;
|
||||
|
||||
memset(bp, 0, sizeof(*term.tabs) * (col - term.col));
|
||||
memset(bp, 0, sizeof(*term.tabs) * (col - term.maxcol));
|
||||
while (--bp > term.tabs && !*bp)
|
||||
/* nothing */ ;
|
||||
for (bp += tabspaces; bp < term.tabs + col; bp += tabspaces)
|
||||
*bp = 1;
|
||||
}
|
||||
/* update terminal size */
|
||||
term.col = col;
|
||||
term.col = tmp;
|
||||
term.maxcol = col;
|
||||
term.row = row;
|
||||
/* reset scrolling region */
|
||||
tsetscroll(0, row-1);
|
||||
|
Loading…
Reference in New Issue
Block a user