From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.devel Subject: Truncating scroll runs that copy to where we copied to Date: Sun, 20 Nov 2011 16:13:59 +0900 Organization: Faculty of Science, Chiba University Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: dough.gmane.org 1321773254 19286 80.91.229.12 (20 Nov 2011 07:14:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 20 Nov 2011 07:14:14 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 20 08:14:10 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RS1bN-0007bk-RO for ged-emacs-devel@m.gmane.org; Sun, 20 Nov 2011 08:14:09 +0100 Original-Received: from localhost ([::1]:33933 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RS1bN-0004SI-3g for ged-emacs-devel@m.gmane.org; Sun, 20 Nov 2011 02:14:09 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:37954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RS1bL-0004S9-Bs for emacs-devel@gnu.org; Sun, 20 Nov 2011 02:14:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RS1bK-0000E0-1M for emacs-devel@gnu.org; Sun, 20 Nov 2011 02:14:07 -0500 Original-Received: from mathmail.math.s.chiba-u.ac.jp ([133.82.132.2]:60963) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RS1bJ-0000Da-Id for emacs-devel@gnu.org; Sun, 20 Nov 2011 02:14:06 -0500 Original-Received: from church.math.s.chiba-u.ac.jp (church [133.82.132.36]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id 736B8C055D for ; Sun, 20 Nov 2011 16:13:59 +0900 (JST) User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) X-detected-operating-system: by eggs.gnu.org: NetBSD 3.0 (DF) X-Received-From: 133.82.132.2 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:146099 Archived-At: 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