X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=st.c;h=60243a7375fe6ec1fadb34728d4a1ed1f0c35c8a;hb=16ac85bf5422a7e925743f6134572d3ac1a25188;hp=dffa84ec19fb6382a668e1254a71470f8f326686;hpb=fe527aa508851d83f166b8f50ae4c2ed5f1e4ec8;p=st.git diff --git a/st.c b/st.c index dffa84e..60243a7 100644 --- a/st.c +++ b/st.c @@ -1414,15 +1414,16 @@ void tscrollup(int orig, int n) { int i; Line temp; + LIMIT(n, 0, term.bot-orig+1); tclearregion(0, orig, term.col-1, orig+n-1); tsetdirt(orig+n, term.bot); for(i = orig; i <= term.bot-n; i++) { - temp = term.line[i]; - term.line[i] = term.line[i+n]; - term.line[i+n] = temp; + temp = term.line[i]; + term.line[i] = term.line[i+n]; + term.line[i+n] = temp; } selscroll(orig, -n);