unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Truncating scroll runs that copy to where we copied to
@ 2011-11-20  7:13 YAMAMOTO Mitsuharu
  2011-11-20 18:23 ` Eli Zaretskii
  2011-11-22  0:33 ` YAMAMOTO Mitsuharu
  0 siblings, 2 replies; 16+ messages in thread
From: YAMAMOTO Mitsuharu @ 2011-11-20  7:13 UTC (permalink / raw)
  To: emacs-devel

I think that `scrolling_window' needs to truncate scroll runs that
copy to where we copied to; otherwise, `assign_row (to, from)' assigns
a previously disabled bogus row in the desired matrix when we have an
overlap in the copy destination.  Such truncation can also avoid
unnecessary copy in the actual graphics operation.

Could someone double-check the code below?

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

=== modified file 'src/dispnew.c'
*** src/dispnew.c	2011-11-19 08:39:42 +0000
--- src/dispnew.c	2011-11-20 06:44:25 +0000
***************
*** 4552,4562 ****
  	    rif->clear_window_mouse_face (w);
  	    rif->scroll_run_hook (w, r);
  
! 	    /* Invalidate runs that copy from where we copied to.  */
  	    for (j = i + 1; j < nruns; ++j)
  	      {
  		struct run *p = runs[j];
  
  		if ((p->current_y >= r->desired_y
  		     && p->current_y < r->desired_y + r->height)
  		    || (p->current_y + p->height >= r->desired_y
--- 4552,4594 ----
  	    rif->clear_window_mouse_face (w);
  	    rif->scroll_run_hook (w, r);
  
! 	    /* Truncate runs that copy to where we copied to, and
! 	       invalidate runs that copy from where we copied to.  */
  	    for (j = i + 1; j < nruns; ++j)
  	      {
  		struct run *p = runs[j];
  
+ 		if (p->nrows > 0
+ 		    && p->desired_vpos < r->desired_vpos + r->nrows
+ 		    && p->desired_vpos + p->nrows > r->desired_vpos)
+ 		  {
+ 		    if (p->desired_vpos < r->desired_vpos)
+ 		      {
+ 			p->nrows = r->desired_vpos - p->desired_vpos;
+ 			p->height = r->desired_y - p->desired_y;
+ 		      }
+ 		    else
+ 		      {
+ 			int nrows_copied = (r->desired_vpos + r->nrows
+ 					    - p->desired_vpos);
+ 
+ 			if (p->nrows <= nrows_copied)
+ 			  p->nrows = 0;
+ 			else
+ 			  {
+ 			    int height_copied = (r->desired_y + r->height
+ 						 - p->desired_y);
+ 
+ 			    p->current_vpos += nrows_copied;
+ 			    p->desired_vpos += nrows_copied;
+ 			    p->nrows -= nrows_copied;
+ 			    p->current_y += height_copied;
+ 			    p->desired_y += height_copied;
+ 			    p->height -= height_copied;
+ 			  }
+ 		      }
+ 		  }
+ 
  		if ((p->current_y >= r->desired_y
  		     && p->current_y < r->desired_y + r->height)
  		    || (p->current_y + p->height >= r->desired_y




^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2011-11-28  1:10 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-20  7:13 Truncating scroll runs that copy to where we copied to YAMAMOTO Mitsuharu
2011-11-20 18:23 ` Eli Zaretskii
2011-11-21  0:19   ` YAMAMOTO Mitsuharu
2011-11-21 23:50     ` David Reitter
2011-11-22  6:04       ` Eli Zaretskii
2011-11-22  6:22         ` YAMAMOTO Mitsuharu
2011-11-22  8:25           ` Eli Zaretskii
2011-11-22  8:47             ` YAMAMOTO Mitsuharu
2011-11-22  7:26         ` YAMAMOTO Mitsuharu
2011-11-22  8:52           ` Eli Zaretskii
2011-11-22  9:09             ` YAMAMOTO Mitsuharu
2011-11-22  9:54               ` Eli Zaretskii
2011-11-23  0:41                 ` YAMAMOTO Mitsuharu
2011-11-26 12:44                   ` Eli Zaretskii
2011-11-28  1:10                     ` YAMAMOTO Mitsuharu
2011-11-22  0:33 ` YAMAMOTO Mitsuharu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).