From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#23755: [PATCH] Move text line right when in box (bug#23755) Date: Sat, 18 Jun 2016 00:17:50 +0100 Message-ID: <20160617231750.GA3670@breton.holly.idiocy.org> References: <83k2hnbmgp.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1466205604 17513 80.91.229.3 (17 Jun 2016 23:20:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 17 Jun 2016 23:20:04 +0000 (UTC) Cc: James Nguyen To: 23755@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jun 18 01:19:54 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bE32f-00083s-9I for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 Jun 2016 01:19:13 +0200 Original-Received: from localhost ([::1]:60635 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bE32e-000119-9Z for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 Jun 2016 19:19:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bE32Y-000106-Mw for bug-gnu-emacs@gnu.org; Fri, 17 Jun 2016 19:19:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bE32U-0000M9-K4 for bug-gnu-emacs@gnu.org; Fri, 17 Jun 2016 19:19:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60474) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bE32U-0000Ly-GN for bug-gnu-emacs@gnu.org; Fri, 17 Jun 2016 19:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bE32U-0002cC-CV for bug-gnu-emacs@gnu.org; Fri, 17 Jun 2016 19:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Jun 2016 23:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23755 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23755-submit@debbugs.gnu.org id=B23755.14662054839985 (code B ref 23755); Fri, 17 Jun 2016 23:19:02 +0000 Original-Received: (at 23755) by debbugs.gnu.org; 17 Jun 2016 23:18:03 +0000 Original-Received: from localhost ([127.0.0.1]:44578 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bE31W-0002ay-Jk for submit@debbugs.gnu.org; Fri, 17 Jun 2016 19:18:02 -0400 Original-Received: from mail-wm0-f66.google.com ([74.125.82.66]:33108) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bE31U-0002aQ-6U for 23755@debbugs.gnu.org; Fri, 17 Jun 2016 19:18:00 -0400 Original-Received: by mail-wm0-f66.google.com with SMTP id r201so1120275wme.0 for <23755@debbugs.gnu.org>; Fri, 17 Jun 2016 16:18:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=SaI2HdvtD/ulhKettHjdWs2KqCgy4xdTFZUeUCPXF7w=; b=RWYr1jENarEWjzHDfSITyQNNQym6NB2EQRXE7KxXhxRKvfLzZ801D5yq2g9JuuM4bn t6spQHiLQYG5abawugSYmy2Vovg+P+6WrKzkYKRdJoHWE0LDrb0qgLwh1Sto1UQIu3s3 FoI3xdV/qbPcK2uH/WaM8AQS0X2erD5ldtEMHzY/KuYEWG5cS4LI+CkFGSWgBRbpgpK4 1H+xn/0wU+Zz1AWsP2zl1hft5UsK0J9sW30ClOtl3XxraOR8vE7nVQRTOqSbRPsnTX0S afVfB04BwL9rpmnFAEZrcNhgA04clxLQdHfPny8NG35GOaywvgw6A6BNtAJleUzp2/9+ wJhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=SaI2HdvtD/ulhKettHjdWs2KqCgy4xdTFZUeUCPXF7w=; b=KerwASjaxmLpO1rv9Gdj0mlNEyPnUqh32QWze0j3J9N/IpBcuItMMskuoKMH9cG4bd w0LOhAMcW/oK8QQcWNDKvUW/VkKk5REjSHTgoV2PSUN4bzTp4jDAAVKXQihp9t5WrpcC 9JusuaqnzuTNwL3whOPuKxUwgwO3xqegj2u/wBPcnPvoB7gdp7HrrqMGYYBvtGI/d7UF VYPpEusKXB70dpMF3XAe//4AKYK836rXMFukuYNvzOR9yRgZrEUZTFONRthoWVteMa70 iGc5HfE6KmYOdF9DUHt5ZvGsdNsvgRmNDU39gA3zi5kpLnvjG5jf5DCnrmdjFhIVjS3a iqUw== X-Gm-Message-State: ALyK8tJ1SF/apB268IVOEsaoKnt1DuKgqMMiok2O0Yu4owoY7LnDfnkLGl8SbS/8xlglWA== X-Received: by 10.194.191.135 with SMTP id gy7mr4313173wjc.125.1466205474517; Fri, 17 Jun 2016 16:17:54 -0700 (PDT) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-ac92-b5d8-4ccd-40fc.holly.idiocy.org. [2001:8b0:3f8:8129:ac92:b5d8:4ccd:40fc]) by smtp.gmail.com with ESMTPSA id ib10sm46550908wjb.31.2016.06.17.16.17.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Jun 2016 16:17:53 -0700 (PDT) Content-Disposition: inline In-Reply-To: <83k2hnbmgp.fsf@gnu.org> User-Agent: Mutt/1.5.24 (2015-08-30) 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: 208.118.235.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:119703 Archived-At: * src/nsterm.m (ns_draw_glyph_string_foreground): Create to take CHAR_GLYPH specific code and move glyphs right if within a box. (ns_draw_glyph_string): Move CHAR_GLYPH specific code into above function. --- src/nsterm.m | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/src/nsterm.m b/src/nsterm.m index f2b0d90..eba75f1 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -3640,6 +3640,32 @@ overwriting cursor (usually when cursor on a tab) */ static void +ns_draw_glyph_string_foreground (struct glyph_string *s) +{ + int x, flags; + struct font *font = s->font; + + /* If first glyph of S has a left box line, start drawing the text + of S to the right of that box line. */ + if (s->face && s->face->box != FACE_NO_BOX + && s->first_glyph->left_box_line_p) + x = s->x + eabs (s->face->box_line_width); + else + x = s->x; + + flags = s->hl == DRAW_CURSOR ? NS_DUMPGLYPH_CURSOR : + (s->hl == DRAW_MOUSE_FACE ? NS_DUMPGLYPH_MOUSEFACE : + (s->for_overlaps ? NS_DUMPGLYPH_FOREGROUND : + NS_DUMPGLYPH_NORMAL)); + + font->driver->draw + (s, s->cmp_from, s->nchars, x, s->ybase, + (flags == NS_DUMPGLYPH_NORMAL && !s->background_filled_p) + || flags == NS_DUMPGLYPH_MOUSEFACE); +} + + +static void ns_draw_composite_glyph_string_foreground (struct glyph_string *s) { int i, j, x; @@ -3737,7 +3763,7 @@ overwriting cursor (usually when cursor on a tab) */ { /* TODO (optimize): focus for box and contents draw */ NSRect r[2]; - int n, flags; + int n; char box_drawn_p = 0; struct font *font = s->face->font; if (! font) font = FRAME_FONT (s->f); @@ -3807,11 +3833,6 @@ overwriting cursor (usually when cursor on a tab) */ ns_maybe_dumpglyphs_background (s, s->first_glyph->type == COMPOSITE_GLYPH); - flags = s->hl == DRAW_CURSOR ? NS_DUMPGLYPH_CURSOR : - (s->hl == DRAW_MOUSE_FACE ? NS_DUMPGLYPH_MOUSEFACE : - (s->for_overlaps ? NS_DUMPGLYPH_FOREGROUND : - NS_DUMPGLYPH_NORMAL)); - if (s->hl == DRAW_CURSOR && s->w->phys_cursor_type == FILLED_BOX_CURSOR) { unsigned long tmp = NS_FACE_BACKGROUND (s->face); @@ -3825,10 +3846,7 @@ overwriting cursor (usually when cursor on a tab) */ if (isComposite) ns_draw_composite_glyph_string_foreground (s); else - font->driver->draw - (s, s->cmp_from, s->nchars, s->x, s->ybase, - (flags == NS_DUMPGLYPH_NORMAL && !s->background_filled_p) - || flags == NS_DUMPGLYPH_MOUSEFACE); + ns_draw_glyph_string_foreground (s); } { -- Looks like the NS port doesn't take a surrounding box into account when displaying normal glyphs (but does with composite glyphs...). I don't know why I could see the digits move left and right as I scrolled, but this patch fixes the problem for me. -- Alan Third