From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#38731: [PATCH] Calculate first glyph to be redrawn when exposing (bug#38731) Date: Fri, 27 Dec 2019 16:26:20 +0000 Message-ID: <20191227162620.GA92799@breton.holly.idiocy.org> References: <20191227143500.GA75733@breton.holly.idiocy.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="231105"; mail-complaints-to="usenet@blaine.gmane.org" Cc: netjune@outlook.com, 38731@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 27 17:31:00 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iksVw-000xyN-7E for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 Dec 2019 17:31:00 +0100 Original-Received: from localhost ([::1]:36944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iksVv-0004pg-28 for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 Dec 2019 11:30:59 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35211) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iksVn-0004pU-8m for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2019 11:30:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iksS5-0000y3-Vf for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2019 11:27:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51765) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iksS5-0000x6-Rf for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2019 11:27:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iksS5-0005t9-Nq for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2019 11:27:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 Dec 2019 16:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38731 X-GNU-PR-Package: emacs Original-Received: via spool by 38731-submit@debbugs.gnu.org id=B38731.157746399322602 (code B ref 38731); Fri, 27 Dec 2019 16:27:01 +0000 Original-Received: (at 38731) by debbugs.gnu.org; 27 Dec 2019 16:26:33 +0000 Original-Received: from localhost ([127.0.0.1]:57738 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iksRd-0005sT-JP for submit@debbugs.gnu.org; Fri, 27 Dec 2019 11:26:33 -0500 Original-Received: from mail-wm1-f67.google.com ([209.85.128.67]:54255) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iksRb-0005sC-Fx for 38731@debbugs.gnu.org; Fri, 27 Dec 2019 11:26:32 -0500 Original-Received: by mail-wm1-f67.google.com with SMTP id m24so8427208wmc.3 for <38731@debbugs.gnu.org>; Fri, 27 Dec 2019 08:26:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=WvViHL/E0dmoF4iYwgItZ56hgKFyivFrac9is3t55aY=; b=K65DZUWzmEu71csRLEr/dhxi805s9mWZt8lo800oyqtVwkvABIHgB9O6ntwG9B+ZEO moKh24y2uu1u9iBKU0T4SbKufZPHw01SRp3qYfu4r6a2UrbtDIp8RirYIkNH5Brdtmwz YYeYGnLXypBGt+8VHWStC1Udwp9nguj7+XLB/OK38N3Fsgj/7+u96/nfzCLzFbqeMa/v H3A7U1fFtTqyFLtTH4jWQzAduY+ZQ8YYWjKPhYyPmpi2wBYotaqS8SuqJ7MyOFynE/pA qzEspTKs60bkn7Jk62n9ihyGHi+EA4YGDnay1UxhTIvZh7oXNYJPZRc97Tbg0mY0zbz3 wSQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=WvViHL/E0dmoF4iYwgItZ56hgKFyivFrac9is3t55aY=; b=Hqb0H42RHb12wWTEYSVbmLmvZyCDmLeSwxyTfQt0hCJnsZgURGKe/C23BDZ7alrmwe ToQFQ/mahmd4mLKjLyE5NsaFBHqPWixrfdZZzSyV/rPYAS1x8RBkLpg/QHdn5c1PDr+K VMPQ04c+vlc51S7ZYsstIWBj/t6krHBIUyx8Ea3sGUMv6B+lO/9c51DNoBtMFM+9+itw aUnF9Z7H+OB6DXEU5NP7DR8faGg3IzLYFJF0AgpVCYlAmxTcw+cbCpTNnuulytQSQwsi whd5A4hsc7GNbtLRb5K9MCch03CuT+T8qc0NqJw/n0opUN9ZXLitoTbW593F38srfStF LovA== X-Gm-Message-State: APjAAAU3sz8jygI0CQnLzRVrAtf9uDTnKtGxa+mdr+fWxP1JKgOrgCCA 8Jo0V3qlzuXuEATy9vM8C4Q= X-Google-Smtp-Source: APXvYqz1kBe2l2e+WNO7SSDvNntwUm+P5JF0j+RMfMCs2MkzKFpyan/MX8wO0NjqAystioktzNaYhg== X-Received: by 2002:a05:600c:2c50:: with SMTP id r16mr19234011wmg.74.1577463983595; Fri, 27 Dec 2019 08:26:23 -0800 (PST) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-5065-467f-7969-bf01.holly.idiocy.org. [2001:8b0:3f8:8129:5065:467f:7969:bf01]) by smtp.gmail.com with ESMTPSA id z21sm11905963wml.5.2019.12.27.08.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 08:26:23 -0800 (PST) Content-Disposition: inline In-Reply-To: <20191227143500.GA75733@breton.holly.idiocy.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:173827 Archived-At: * src/xdisp.c (expose_area): When the face extends to the end of the line calculate the first glyph to be redrawn rather than assuming it starts at the first glyph in the row. --- src/xdisp.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 3080f8920a..42a86a1d12 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -33489,30 +33489,30 @@ expose_area (struct window *w, struct glyph_row *row, const Emacs_Rectangle *r, struct glyph *last; int first_x, start_x, x; + /* Set START_X to the window-relative start position for drawing glyphs of + AREA. The first glyph of the text area can be partially visible. + The first glyphs of other areas cannot. */ + start_x = window_box_left_offset (w, area); + x = start_x; + if (area == TEXT_AREA) + x += row->x; + + /* Find the first glyph that must be redrawn. */ + while (first < end + && x + first->pixel_width < r->x) + { + x += first->pixel_width; + ++first; + } + if (area == TEXT_AREA && row->fill_line_p) /* If row extends face to end of line write the whole line. */ - draw_glyphs (w, 0, row, area, - 0, row->used[area], + draw_glyphs (w, x - start_x, row, area, + first - row->glyphs[area], row->used[area], DRAW_NORMAL_TEXT, 0); else { - /* Set START_X to the window-relative start position for drawing glyphs of - AREA. The first glyph of the text area can be partially visible. - The first glyphs of other areas cannot. */ - start_x = window_box_left_offset (w, area); - x = start_x; - if (area == TEXT_AREA) - x += row->x; - - /* Find the first glyph that must be redrawn. */ - while (first < end - && x + first->pixel_width < r->x) - { - x += first->pixel_width; - ++first; - } - - /* Find the last one. */ + /* Find the last glyph to be redrawn. */ last = first; first_x = x; /* Use a signed int intermediate value to avoid catastrophic -- 2.24.0 -- Alan Third