repo: rxvt-unicode-sixel
action: commit
revision: 
path_from: 
revision_from: 18ef944f1bfdc67ae2cddb7b56bf1734732447b6:
path_to: 
revision_to: 
git.thebackupbox.net
rxvt-unicode-sixel
git clone git://git.thebackupbox.net/rxvt-unicode-sixel
commit 18ef944f1bfdc67ae2cddb7b56bf1734732447b6
Author: Marc Lehmann 
Date:   Mon Dec 26 21:30:04 2005 +0000

    *** empty log message ***

diff --git a/Changes b/Changes
index bc4416f3b8634f43b13ae6e7665e55d968a6dd18..
index ..620425f2358d2afb64e82108e94e33ad9899083e 100644
--- a/Changes
+++ b/Changes
@@ -10,6 +10,10 @@ WISH: meta-tagging of data by regex/master process (my dream project)
 WISH: OnTheSpot editing, or maybe switch to miiiiiiif
 WISH: just for fun, do shade and tint with XRender.

+6.1
+	- fix a crash when the selection scrolls out of the scrollback
+          while the user still drags.
+
 6.0  Sat Dec 24 13:58:56 CET 2005
 	- make it compile without SMART_RESIZE again.
         - enable slow link support by default.
diff --git a/src/screen.C b/src/screen.C
index 513205a50e43df7017b67235641a8283bf5b3c85..
index ..e285c855ed1dfd3eb94b298621a5f15df87aab8d 100644
--- a/src/screen.C
+++ b/src/screen.C
@@ -622,7 +622,13 @@ rxvt_term::scr_scroll_text (int row1, int row2, int count)
           selection.end.row  -= count;
           selection.mark.row -= count;

-          selection_check (0);
+          if (selection.beg.row < -nsaved
+              || selection.end.row < -nsaved
+              || selection.mark.row < -nsaved)
+            {
+              CLEAR_ALL_SELECTION ();
+              selection.op = SELECTION_CLEAR;
+            }
         }

       for (int i = count; i--; )
@@ -637,20 +643,17 @@ rxvt_term::scr_scroll_text (int row1, int row2, int count)
     {
       if (selection.op && current_screen == selection.screen)
         {
-          int i = selection.beg.row;
-          int j = selection.end.row;
-
-          if ((i < row1 && j > row1)
-              || (i < row2 && j > row2)
-              || (i - count < row1 && i >= row1)
-              || (i - count > row2 && i <= row2)
-              || (j - count < row1 && j >= row1)
-              || (j - count > row2 && j <= row2))
+          if ((selection.beg.row < row1 && selection.end.row > row1)
+              || (selection.beg.row < row2 && selection.end.row > row2)
+              || (selection.beg.row - count < row1 && selection.beg.row >= row1)
+              || (selection.beg.row - count > row2 && selection.beg.row <= row2)
+              || (selection.end.row - count < row1 && selection.end.row >= row1)
+              || (selection.end.row - count > row2 && selection.end.row <= row2))
             {
               CLEAR_ALL_SELECTION ();
-              selection.op = SELECTION_CLEAR;  /* XXX: too aggressive? */
+              selection.op = SELECTION_CLEAR;
             }
-          else if (j >= row1 && j <= row2)
+          else if (selection.end.row >= row1 && selection.end.row <= row2)
             {
               /* move selected region too */
               selection.beg.row  -= count;

-----END OF PAGE-----