unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: 23755@debbugs.gnu.org
Cc: James Nguyen <ja.nguyen@gmail.com>
Subject: bug#23755: [PATCH] Move text line right when in box (bug#23755)
Date: Sat, 18 Jun 2016 00:17:50 +0100	[thread overview]
Message-ID: <20160617231750.GA3670@breton.holly.idiocy.org> (raw)
In-Reply-To: <83k2hnbmgp.fsf@gnu.org>

* 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





  reply	other threads:[~2016-06-17 23:17 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-12 17:19 bug#23755: 25.0.95; Emacs 25.0.95 Line number is in fringe ja.nguyen
2016-06-12 17:48 ` Eli Zaretskii
     [not found]   ` <6D7D3844-4E4A-4341-8F9C-DE18481480F5@gmail.com>
2016-06-12 19:53     ` Eli Zaretskii
2016-06-12 21:50       ` Alan Third
2016-06-12 22:03         ` James Nguyen
2016-06-13  4:00         ` Eli Zaretskii
2016-06-13  4:01           ` James Nguyen
2016-06-13 13:48             ` Eli Zaretskii
2016-06-16 15:17               ` Eli Zaretskii
2016-06-16 15:30                 ` James Nguyen
2016-06-17  5:50                 ` James Nguyen
2016-06-17  7:21                   ` Eli Zaretskii
2016-06-17 13:15                     ` James Nguyen
2016-06-17 17:41                     ` Alan Third
2016-06-17 17:48                       ` James Nguyen
2016-06-17 17:58                         ` Alan Third
2016-06-17 19:56                           ` James Nguyen
2016-06-17 20:16                             ` Eli Zaretskii
2016-06-17 23:17                               ` Alan Third [this message]
2016-06-18  8:22                                 ` bug#23755: [PATCH] Move text line right when in box (bug#23755) Eli Zaretskii
2016-06-26  0:34                                   ` Alan Third
2016-06-17 20:14                       ` bug#23755: 25.0.95; Emacs 25.0.95 Line number is in fringe Eli Zaretskii
2016-06-13  7:18           ` Alan Third
2016-06-13 13:50             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160617231750.GA3670@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=23755@debbugs.gnu.org \
    --cc=ja.nguyen@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).