summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAiden Gall <aiden@aidengall.xyz>2023-11-20 23:41:20 +0000
committerAiden Gall <aiden@aidengall.xyz>2023-11-20 23:41:20 +0000
commit7a87f8375e39c1923d97a6e908a17b95efc8e750 (patch)
treecf55d8831e7ad0c4aa6be8dc9288b129a3ee179d
parent657de4a361d65fd8e4832ef65be280264a7f7a02 (diff)
fix indentation, clean up repetitiveness
-rw-r--r--st.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/st.c b/st.c
index a6f541b..62bfcff 100644
--- a/st.c
+++ b/st.c
@@ -558,11 +558,11 @@ selnormalize(void)
if (sel.type == SEL_RECTANGULAR)
return;
- i = tlinelen(TLINE(sel.nb.y));
+ i = tlinelen(TLINE(sel.nb.y));
if (sel.nb.x > i)
sel.nb.x = i;
- if (sel.ne.x >= tlinelen(TLINE(sel.ne.y)))
- sel.ne.x = term.col - 1;
+ if (sel.ne.x >= tlinelen(TLINE(sel.ne.y)))
+ sel.ne.x = term.col - 1;
}
int
@@ -1066,8 +1066,7 @@ tsetdirtattr(int attr)
void
tfulldirt(void)
{
- for (int i = 0; i < term.row; i++)
- term.dirty[i] = 1;
+ tsetdirt(0, term.row-1);
}
void
@@ -1095,7 +1094,7 @@ void
treset(void)
{
uint i;
- int x, y;
+ int x, y;
tresetcursor();
@@ -1110,15 +1109,14 @@ treset(void)
memset(term.trantbl, CS_USA, sizeof(term.trantbl));
term.charset = 0;
- selremove();
+ selremove();
for (i = 0; i < 2; i++) {
- tcursor(CURSOR_SAVE); /* reset saved cursor */
- for (y = 0; y < term.row; y++)
- for (x = 0; x < term.col; x++)
- tclearglyph(&term.line[y][x], 0);
+ tmoveto(0, 0);
+ tcursor(CURSOR_SAVE); /* reset saved cursor */
+ tclearregion(0, 0, term.col-1, term.row-1, 1);
tswapscreen();
}
- tfulldirt();
+ tfulldirt();
}
void
@@ -1137,7 +1135,7 @@ tnew(int col, int row)
term.tabs = xmalloc(col * sizeof(*term.tabs));
for (i = 0; i < HISTSIZE; i++)
term.hist[i] = xmalloc(col * sizeof(Glyph));
- treset();
+ treset();
}
/* handle it with care */
@@ -1435,7 +1433,7 @@ tsetchar(Rune u, const Glyph *attr, int x, int y)
} else if (term.line[y][x].mode & ATTR_WDUMMY) {
term.line[y][x-1].u = ' ';
term.line[y][x-1].mode &= ~ATTR_WIDE;
- }
+ }
term.dirty[y] = 1;
term.line[y][x] = *attr;
@@ -1770,7 +1768,7 @@ tsetmode(int priv, int set, const int *args, int narg)
break;
case 1048:
if (!allowaltscreen)
- break;
+ break;
tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD);
break;
case 2004: /* 2004: bracketed paste mode */
@@ -1932,9 +1930,9 @@ csihandle(void)
break;
case 2: /* all */
if (IS_SET(MODE_ALTSCREEN)) {
- tclearregion(0, 0, term.col-1, term.row-1, 1);
- break;
- }
+ tclearregion(0, 0, term.col-1, term.row-1, 1);
+ break;
+ }
/* vte does this:
tscrollup(0, term.row-1, term.row, SCROLL_SAVEHIST); */
@@ -1943,7 +1941,7 @@ csihandle(void)
if (n >= 0)
tscrollup(0, term.row-1, n+1, SCROLL_SAVEHIST);
tscrollup(0, term.row-1, term.row-n-1, SCROLL_NOSAVEHIST);
- break;
+ break;
default:
goto unknown;
}
@@ -2313,7 +2311,7 @@ void
tdumpline(int n)
{
char str[(term.col + 1) * UTF_SIZ];
- tprinter(str, tgetline(str, &term.line[n][0]));
+ tprinter(str, tgetline(str, &term.line[n][0]));
}
void