From 9583e9a03cf4980041a97d397682d0e1861aa1a7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Dj=C3=A4rv?= Date: Thu, 2 Dec 2010 09:24:16 +0100 Subject: [PATCH] Draw text under filled box cursor in inverted color (Bug#7479). * src/nsterm.m (ns_draw_glyph_string): Switch fore- and background if drawing text under filled box cursor. --- src/ChangeLog | 5 +++++ src/nsterm.m | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index b1d67c9c31f..83d6d4c6e88 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-12-02 Jan Djärv + + * nsterm.m (ns_draw_glyph_string): Switch fore- and background if + drawing text under filled box cursor (Bug#7479). + 2010-11-27 Kenichi Handa * charset.c (emacs_mule_charset): Make it an array of charset ID; diff --git a/src/nsterm.m b/src/nsterm.m index 3adb67717d5..128c9de86a0 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2996,11 +2996,25 @@ ns_draw_glyph_string (struct glyph_string *s) if (ns_tmp_font == NULL) ns_tmp_font = (struct nsfont_info *)FRAME_FONT (s->f); + if (s->hl == DRAW_CURSOR && s->w->phys_cursor_type == FILLED_BOX_CURSOR) + { + unsigned long tmp = NS_FACE_BACKGROUND (s->face); + NS_FACE_BACKGROUND (s->face) = NS_FACE_FOREGROUND (s->face); + NS_FACE_FOREGROUND (s->face) = tmp; + } + ns_tmp_font->font.driver->draw (s, 0, s->nchars, s->x, s->y, (ns_tmp_flags == NS_DUMPGLYPH_NORMAL && !s->background_filled_p) || ns_tmp_flags == NS_DUMPGLYPH_MOUSEFACE); + if (s->hl == DRAW_CURSOR && s->w->phys_cursor_type == FILLED_BOX_CURSOR) + { + unsigned long tmp = NS_FACE_BACKGROUND (s->face); + NS_FACE_BACKGROUND (s->face) = NS_FACE_FOREGROUND (s->face); + NS_FACE_FOREGROUND (s->face) = tmp; + } + ns_unfocus (s->f); break; -- 2.39.5