[hackers] [st] Do not save cursor in tresize. || noname

From: <git_AT_suckless.org>
Date: Tue, 29 Apr 2014 15:18:26 +0200

commit 6b315558f8095b91988d5b305ed06e082da48889
Author: noname <noname_AT_inventati.org>
Date: Tue Apr 29 02:35:22 2014 +0400

    Do not save cursor in tresize.
    
    This patch fixes the bug introduced in
    8f11e1cd034ff28ca47bb4955505db7fa8016ba8
    
    To reproduce the bug:
    1. Save cursor: printf '\e[s'
    2. Load cursor: printf '\e[u'
    3. Resize st window.
    4. Load cursor again: printf '\e[u'

diff --git a/st.c b/st.c
index 5198749..c50a202 100644
--- a/st.c
+++ b/st.c
_AT_@ -2634,6 +2634,7 @@ tresize(int col, int row) {
         int slide = term.c.y - row + 1;
         bool *bp;
         Line *orig;
+ TCursor c;
 
         if(col < 1 || row < 1)
                 return 0;
_AT_@ -2695,6 +2696,7 @@ tresize(int col, int row) {
         tmoveto(term.c.x, term.c.y);
         /* Clearing both screens */
         orig = term.line;
+ c = term.c;
         do {
                 if(mincol < col && 0 < minrow) {
                         tclearregion(mincol, 0, col - 1, minrow - 1);
_AT_@ -2702,10 +2704,10 @@ tresize(int col, int row) {
                 if(0 < col && minrow < row) {
                         tclearregion(0, minrow, col - 1, row - 1);
                 }
- tcursor(CURSOR_SAVE);
                 tswapscreen();
                 tcursor(CURSOR_LOAD);
         } while(orig != term.line);
+ term.c = c;
 
         return (slide > 0);
 }
Received on Tue Apr 29 2014 - 15:18:26 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 29 2014 - 15:24:15 CEST