diff options
| author | noname <noname@inventati.org> | 2014-04-20 17:26:13 +0400 |
|---|---|---|
| committer | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2014-04-23 20:35:16 +0200 |
| commit | 3afdb4ff04b45a5e4209a56d5073341c9d506b38 (patch) | |
| tree | 94a038e33f121c962b35d8d1bcfe4b3b3fefad07 /st.c | |
| parent | Fix techo handling of control and multibyte characters. (diff) | |
| download | st-3afdb4ff04b45a5e4209a56d5073341c9d506b38.tar.gz st-3afdb4ff04b45a5e4209a56d5073341c9d506b38.zip | |
Use tsetdirt in tscrollup and tscrolldown.
tscrollup and tscrolldown do not use tsetdirt, but their code is
equivalent to
tsetdirt(orig, term.bot-n);
tsetdirt(orig+n, term.bot);
tclearregion also marks cleared lines as dirty.
In tscrolldown it sets lines from term.bot-n+1 to term.bot dirty, and in
tscrollup it sets lines from orig to orig+n-1 dirty.
In both functions all lines from orig to term.bot are effectively set
dirty, but in tscrolldown lines from orig+n to term.bot are set dirty
twice, and in tscrollup lines from orig to term.bot-n are set dirty
twice.
These patches make it clear which lines are set dirty and sets them
dirty once in each funciton.
Diffstat (limited to '')
| -rw-r--r-- | st.c | 10 |
1 files changed, 4 insertions, 6 deletions
| @@ -1399,14 +1399,13 @@ tscrolldown(int orig, int n) { | |||
| 1399 | LIMIT(n, 0, term.bot-orig+1); | 1399 | LIMIT(n, 0, term.bot-orig+1); |
| 1400 | 1400 | ||
| 1401 | tclearregion(0, term.bot-n+1, term.col-1, term.bot); | 1401 | tclearregion(0, term.bot-n+1, term.col-1, term.bot); |
| 1402 | tsetdirt(orig, term.bot-n); | ||
| 1403 | tsetdirt(orig+n, term.bot); | ||
| 1402 | 1404 | ||
| 1403 | for(i = term.bot; i >= orig+n; i--) { | 1405 | for(i = term.bot; i >= orig+n; i--) { |
| 1404 | temp = term.line[i]; | 1406 | temp = term.line[i]; |
| 1405 | term.line[i] = term.line[i-n]; | 1407 | term.line[i] = term.line[i-n]; |
| 1406 | term.line[i-n] = temp; | 1408 | term.line[i-n] = temp; |
| 1407 | |||
| 1408 | term.dirty[i] = 1; | ||
| 1409 | term.dirty[i-n] = 1; | ||
| 1410 | } | 1409 | } |
| 1411 | 1410 | ||
| 1412 | selscroll(orig, n); | 1411 | selscroll(orig, n); |
| @@ -1419,14 +1418,13 @@ tscrollup(int orig, int n) { | |||
| 1419 | LIMIT(n, 0, term.bot-orig+1); | 1418 | LIMIT(n, 0, term.bot-orig+1); |
| 1420 | 1419 | ||
| 1421 | tclearregion(0, orig, term.col-1, orig+n-1); | 1420 | tclearregion(0, orig, term.col-1, orig+n-1); |
| 1421 | tsetdirt(orig, term.bot-n); | ||
| 1422 | tsetdirt(orig+n, term.bot); | ||
| 1422 | 1423 | ||
| 1423 | for(i = orig; i <= term.bot-n; i++) { | 1424 | for(i = orig; i <= term.bot-n; i++) { |
| 1424 | temp = term.line[i]; | 1425 | temp = term.line[i]; |
| 1425 | term.line[i] = term.line[i+n]; | 1426 | term.line[i] = term.line[i+n]; |
| 1426 | term.line[i+n] = temp; | 1427 | term.line[i+n] = temp; |
| 1427 | |||
| 1428 | term.dirty[i] = 1; | ||
| 1429 | term.dirty[i+n] = 1; | ||
| 1430 | } | 1428 | } |
| 1431 | 1429 | ||
| 1432 | selscroll(orig, -n); | 1430 | selscroll(orig, -n); |
