From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.devel Subject: Re: Patch for Mac OS X Text Drawing Date: Mon, 24 Jan 2005 18:36:42 +0900 Organization: Faculty of Science, Chiba University Message-ID: References: <0F0CEC8B-6757-11D9-9ECE-000D93B67DC4@mac.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: sea.gmane.org 1106560141 914 80.91.229.6 (24 Jan 2005 09:49:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 24 Jan 2005 09:49:01 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 24 10:48:49 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Ct0q0-0000uD-00 for ; Mon, 24 Jan 2005 10:48:48 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ct12C-00068b-Qp for ged-emacs-devel@m.gmane.org; Mon, 24 Jan 2005 05:01:24 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ct0ye-0005EA-0W for emacs-devel@gnu.org; Mon, 24 Jan 2005 04:57:44 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ct0wm-0004bm-Ps for emacs-devel@gnu.org; Mon, 24 Jan 2005 04:55:54 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ct0wi-0004Rw-Ur for emacs-devel@gnu.org; Mon, 24 Jan 2005 04:55:45 -0500 Original-Received: from [133.82.132.2] (helo=mathmail.math.s.chiba-u.ac.jp) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Ct0eM-0002An-CT for emacs-devel@gnu.org; Mon, 24 Jan 2005 04:36:47 -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 42A731A63AA for ; Mon, 24 Jan 2005 18:36:42 +0900 (JST) Original-To: emacs-devel@gnu.org In-Reply-To: <200501210353.j0L3rbj16707@church.math.s.chiba-u.ac.jp> User-Agent: Wanderlust/2.12.0 (Your Wildest Dreams) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.3.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:32525 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:32525 >>>>> On Fri, 21 Jan 2005 16:57:51 +0900, YAMAMOTO Mitsuharu said: > Could someone check if the following change makes sense? It turned out that the posted patch was closely related to the following problem (also on X11), which I've reported to emacs-pretest-bug: >>>>> On Fri, 21 Jan 2005 12:53:37 +0900 (JST), YAMAMOTO Mitsuharu said: > I noticed that the cursor remained unerased with the following > procedure: > 1. % emacs -Q -fn -adobe-courier-bold-o-normal--12-120-75-75-m-70-iso8859-1 & > 2. Type "RET C-p W C-b W W W W ...." > This happens with any cursor type. Here is a revised patch including a fix for the above bug. YAMAMOTO Mituharu mituharu@math.s.chiba-u.ac.jp Index: src/dispextern.h =================================================================== RCS file: /cvsroot/emacs/emacs/src/dispextern.h,v retrieving revision 1.192 diff -c -r1.192 dispextern.h *** src/dispextern.h 10 Jan 2005 13:30:46 -0000 1.192 --- src/dispextern.h 24 Jan 2005 08:42:45 -0000 *************** *** 1193,1198 **** --- 1193,1203 ---- /* Slice */ struct glyph_slice slice; + /* Non-null means the horizontal clipping region starts from the + left edge of *clip_head, and ends with the right edge of + *clip_tail, not including their overhangs. */ + struct glyph_string *clip_head, *clip_tail; + struct glyph_string *next, *prev; }; Index: src/xdisp.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/xdisp.c,v retrieving revision 1.969 diff -c -r1.969 xdisp.c *** src/xdisp.c 23 Jan 2005 00:50:52 -0000 1.969 --- src/xdisp.c 24 Jan 2005 08:42:47 -0000 *************** *** 1786,1791 **** --- 1786,1809 ---- r.height = s->row->visible_height; } + if (s->clip_head) + if (r.x < s->clip_head->x) + { + if (r.width >= s->clip_head->x - r.x) + r.width -= s->clip_head->x - r.x; + else + r.width = 0; + r.x = s->clip_head->x; + } + if (s->clip_tail) + if (r.x + r.width > s->clip_tail->x + s->clip_tail->background_width) + { + if (s->clip_tail->x + s->clip_tail->background_width >= r.x) + r.width = s->clip_tail->x + s->clip_tail->background_width - r.x; + else + r.width = 0; + } + /* If S draws overlapping rows, it's sufficient to use the top and bottom of the window for clipping because this glyph string intentionally draws over other lines. */ *************** *** 18231,18236 **** --- 18249,18255 ---- { struct glyph_string *head, *tail; struct glyph_string *s; + struct glyph_string *clip_head = NULL, *clip_tail = NULL; int last_x, area_width; int x_reached; int i, j; *************** *** 18299,18304 **** --- 18318,18324 ---- start = i; compute_overhangs_and_x (t, head->x, 1); prepend_glyph_string_lists (&head, &tail, h, t); + clip_head = head; } /* Prepend glyph strings for glyphs in front of the first glyph *************** *** 18311,18316 **** --- 18331,18337 ---- i = left_overwriting (head); if (i >= 0) { + clip_head = head; BUILD_GLYPH_STRINGS (i, start, h, t, DRAW_NORMAL_TEXT, dummy_x, last_x); for (s = h; s; s = s->next) *************** *** 18330,18335 **** --- 18351,18357 ---- DRAW_NORMAL_TEXT, x, last_x); compute_overhangs_and_x (h, tail->x + tail->width, 0); append_glyph_string_lists (&head, &tail, h, t); + clip_tail = tail; } /* Append glyph strings for glyphs following the last glyph *************** *** 18340,18345 **** --- 18362,18368 ---- i = right_overwriting (tail); if (i >= 0) { + clip_tail = tail; BUILD_GLYPH_STRINGS (end, i, h, t, DRAW_NORMAL_TEXT, x, last_x); for (s = h; s; s = s->next) *************** *** 18347,18352 **** --- 18370,18381 ---- compute_overhangs_and_x (h, tail->x + tail->width, 0); append_glyph_string_lists (&head, &tail, h, t); } + if (clip_head || clip_tail) + for (s = head; s; s = s->next) + { + s->clip_head = clip_head; + s->clip_tail = clip_tail; + } } /* Draw all strings. */ *************** *** 18360,18367 **** completely. */ && !overlaps_p) { ! int x0 = head ? head->x : x; ! int x1 = tail ? tail->x + tail->background_width : x; int text_left = window_box_left (w, TEXT_AREA); x0 -= text_left; --- 18389,18397 ---- completely. */ && !overlaps_p) { ! int x0 = clip_head ? clip_head->x : (head ? head->x : x); ! int x1 = (clip_tail ? clip_tail->x + clip_tail->background_width ! : (tail ? tail->x + tail->background_width : x)); int text_left = window_box_left (w, TEXT_AREA); x0 -= text_left;