* Cursors: Is superimposing the same glyph a feature?
@ 2019-02-15 16:27 Keith David Bershatsky
2019-02-15 18:31 ` Eli Zaretskii
0 siblings, 1 reply; 8+ messages in thread
From: Keith David Bershatsky @ 2019-02-15 16:27 UTC (permalink / raw)
To: Emacs Devel
I am working on feature requests 22873 (multiple fake cursors) and 17684 (visible crosshairs that track the cursor position, and a visible fill column indicator).
When draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR) happens, the background of a glyph is _not_ filled (i.e, !s->background_filled_p). This is presumably for a situation such as a FILLED_BOX_CURSOR so as not to erase the colored rectangle around the glyph.
In the case of an HBAR_CURSOR; however, the result is a second imprint of the same glyph -- creating a bold appearance of the glyph with the cursor. Is the bold appearance "a feature", or is this something that has just been overlooked?
Thanks,
Keith
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Cursors: Is superimposing the same glyph a feature?
@ 2019-02-16 7:34 Keith David Bershatsky
2019-02-16 10:05 ` Eli Zaretskii
2019-02-16 11:00 ` Alan Third
0 siblings, 2 replies; 8+ messages in thread
From: Keith David Bershatsky @ 2019-02-16 7:34 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Thank you, Eli, for reading and responding to this particular thread.
Here is a link to a screenshot depicting a somewhat bold appearance of the letter "A" on Emacs 26.1 for OSX without any modifications to the source code -- the build was downloaded from https://emacsformacosx.com/. HBAR_CURSOR and BAR_CURSOR have the same result.
https://www.lawlist.com/images/hbar_double_imprint.png
Here are my minimal settings in the .emacs file, and then I blew-up the size of the font to get a better screenshot:
(blink-cursor-mode -1)
(setq default-frame-alist (list '(cursor-type . (hbar . 1))
'(background-color . "black")
'(foreground-color . "white")))
You may need to blow-up the image and break-out the micrometer to discern that the letter "A" with the HBAR_CURSOR is somewhat wider, with more jagged edges, and the middle triangle is somewhat smaller (because the walls of the letter "A" are thicker). This phenomenon is more easily noticed with the naked eye when holding down the left/right arrow key (repeating) and watching the character at point become bold, and then the bold is removed when moving on to the next character at point.
From what I have been able to discern, drawing a cursor inhibits/prevents ns_maybe_dumpglyphs_background from erasing the glyph area (i.e., no erasing rectangle is drawn), and drawing a cursor also inhibits/prevents font->driver->draw (within ns_draw_glyph_string) from drawing the glyph "with the background". The result is a double-imprint over an existing glyph creating a somewhat bold appearance.
The reason this question is being asked (i.e., whether this is a feature or simply an oversight) is because I would like to redraw the fake cursors when they get erased due to a left_overwritten situation as determined by draw_glyphs in xdisp.c. I can simply draw a fake HBAR/BAR cursor without drawing a new glyph; or, I can follow-up the creation of fake cursor with font->driver->draw and double-imprint the glyph -- by not erasing the glyph area beforehand with a rectangle, and by ensuring that the last argument to font->driver->draw is NIL (i.e., draw the glyph without any background).
I do not see this same behavior on the NT or X11 ports of the GUI version of Emacs.
A little more background information: I am working on update_window and update_text_area to redraw the fake cursors that get erased when the screen updates by calls to write_glyphs and clear_end_of_line.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> Date: [02-15-2019 10:31:34] <15 Feb 2019 20:31:34 +0200>
> From: Eli Zaretskii <eliz@gnu.org>
> To: Keith David Bershatsky <esq@lawlist.com>
> CC: emacs-devel@gnu.org
> Subject: Re: Cursors: Is superimposing the same glyph a feature?
>
> > Date: Fri, 15 Feb 2019 08:27:32 -0800
> > From: Keith David Bershatsky <esq@lawlist.com>
> >
> > In the case of an HBAR_CURSOR; however, the result is a second imprint of the same glyph -- creating a bold appearance of the glyph with the cursor. Is the bold appearance "a feature", or is this something that has just been overlooked?
>
> Where do you see the character at point being bold with hbar cursor?
> I don't see it here.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Cursors: Is superimposing the same glyph a feature?
2019-02-16 7:34 Keith David Bershatsky
@ 2019-02-16 10:05 ` Eli Zaretskii
2019-02-16 11:00 ` Alan Third
1 sibling, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2019-02-16 10:05 UTC (permalink / raw)
To: Keith David Bershatsky; +Cc: emacs-devel
> Date: Fri, 15 Feb 2019 23:34:35 -0800
> From: Keith David Bershatsky <esq@lawlist.com>
> Cc: emacs-devel@gnu.org
>
> I do not see this same behavior on the NT or X11 ports of the GUI version of Emacs.
Exactly my point: this is an NS-specific issue. It shouldn't happen.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Cursors: Is superimposing the same glyph a feature?
2019-02-16 7:34 Keith David Bershatsky
2019-02-16 10:05 ` Eli Zaretskii
@ 2019-02-16 11:00 ` Alan Third
1 sibling, 0 replies; 8+ messages in thread
From: Alan Third @ 2019-02-16 11:00 UTC (permalink / raw)
To: Keith David Bershatsky; +Cc: Eli Zaretskii, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1368 bytes --]
On Fri, Feb 15, 2019 at 11:34:35PM -0800, Keith David Bershatsky wrote:
>
> Here are my minimal settings in the .emacs file, and then I blew-up the size of the font to get a better screenshot:
>
> (blink-cursor-mode -1)
>
> (setq default-frame-alist (list '(cursor-type . (hbar . 1))
> '(background-color . "black")
> '(foreground-color . "white")))
>
> You may need to blow-up the image and break-out the micrometer to
> discern that the letter "A" with the HBAR_CURSOR is somewhat wider,
> with more jagged edges, and the middle triangle is somewhat smaller
> (because the walls of the letter "A" are thicker). This phenomenon
> is more easily noticed with the naked eye when holding down the
> left/right arrow key (repeating) and watching the character at point
> become bold, and then the bold is removed when moving on to the next
> character at point.
I can see it too. I’d never noticed. I doubt very much it’s
intentional.
It looks like the NS port does the wrong thing here. At the moment it
redraws the glyph on top of the cursor as long as CURSOR_TYPE !=
NO_CURSOR, but looking at an X build, it looks as though HBAR_CURSOR,
for example, should cover the glyph.
So I reckon we should only redraw the glyph if the cursor is filled box or
hollow box.
Patch attached.
--
Alan Third
[-- Attachment #2: 0001-Prevent-redrawing-the-glyph-on-top-of-bar-cursors.patch --]
[-- Type: text/plain, Size: 1006 bytes --]
From 1638ac50070d6802329eae13eeba7926ed4c9149 Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Sat, 16 Feb 2019 10:56:13 +0000
Subject: [PATCH] Prevent redrawing the glyph on top of bar cursors
* src/nsterm.m (ns_draw_window_cursor): Limit when we redraw the
glyph.
---
src/nsterm.m | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/nsterm.m b/src/nsterm.m
index bbd2c84214..5d2b0a0812 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3126,8 +3126,9 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors.
break;
}
- /* draw the character under the cursor */
- if (cursor_type != NO_CURSOR)
+ /* Draw the character under the cursor. Other terms only draw
+ the character on top of box cursors, so do the same here. */
+ if (cursor_type == FILLED_BOX_CURSOR || cursor_type == HOLLOW_BOX_CURSOR)
draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR);
ns_reset_clipping (f);
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: Cursors: Is superimposing the same glyph a feature?
@ 2019-02-16 16:28 Keith David Bershatsky
0 siblings, 0 replies; 8+ messages in thread
From: Keith David Bershatsky @ 2019-02-16 16:28 UTC (permalink / raw)
To: Alan Third, Eli Zaretskii; +Cc: emacs-devel
Thank you both.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> Date: [02-16-2019 03:00:21] <16 Feb 2019 11:00:21 +0000>
> From: Alan Third <alan@idiocy.org>
> To: Keith David Bershatsky <esq@lawlist.com>
> Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
> Subject: Re: Cursors: Is superimposing the same glyph a feature?
>
> * * *
>
> I can see it too. I'd never noticed. I doubt very much it's
> intentional.
>
> It looks like the NS port does the wrong thing here. At the moment it
> redraws the glyph on top of the cursor as long as CURSOR_TYPE !=
> NO_CURSOR, but looking at an X build, it looks as though HBAR_CURSOR,
> for example, should cover the glyph.
>
> So I reckon we should only redraw the glyph if the cursor is filled box or
> hollow box.
>
> Patch attached.
> --
> Alan Third
>
> [* 0001-Prevent-redrawing-the-glyph-on-top-of-bar-cursors.patch]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Cursors: Is superimposing the same glyph a feature?
@ 2019-03-08 3:33 Keith David Bershatsky
2019-03-09 9:22 ` Alan Third
0 siblings, 1 reply; 8+ messages in thread
From: Keith David Bershatsky @ 2019-03-08 3:33 UTC (permalink / raw)
To: Alan Third; +Cc: Eli Zaretskii, emacs-devel
I noticed tonight that the proposed patch has not yet been applied to the master branch. I actually use the superimposing bug/feature for debugging because it visually tells me if I have wrong coordinates; however, it would probably be best if all three GUI ports behaved the same (i.e., no superimposing / no semi-bold effect for HBAR/BAR_CURSOR).
Keith
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> Date: [02-16-2019 03:00:21] <16 Feb 2019 11:00:21 +0000>
> From: Alan Third <alan@idiocy.org>
> To: Keith David Bershatsky <esq@lawlist.com>
> Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
> Subject: Re: Cursors: Is superimposing the same glyph a feature?
>
> * * *
>
> [* 0001-Prevent-redrawing-the-glyph-on-top-of-bar-cursors.patch]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Cursors: Is superimposing the same glyph a feature?
2019-03-08 3:33 Keith David Bershatsky
@ 2019-03-09 9:22 ` Alan Third
0 siblings, 0 replies; 8+ messages in thread
From: Alan Third @ 2019-03-09 9:22 UTC (permalink / raw)
To: Keith David Bershatsky; +Cc: Eli Zaretskii, emacs-devel
On Thu, Mar 07, 2019 at 07:33:19PM -0800, Keith David Bershatsky wrote:
> I noticed tonight that the proposed patch has not yet been applied
> to the master branch. I actually use the superimposing bug/feature
> for debugging because it visually tells me if I have wrong
> coordinates; however, it would probably be best if all three GUI
> ports behaved the same (i.e., no superimposing / no semi-bold effect
> for HBAR/BAR_CURSOR).
Sorry, I’ve been quite busy. It’s now on master.
--
Alan Third
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-03-09 9:22 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-15 16:27 Cursors: Is superimposing the same glyph a feature? Keith David Bershatsky
2019-02-15 18:31 ` Eli Zaretskii
-- strict thread matches above, loose matches on Subject: below --
2019-02-16 7:34 Keith David Bershatsky
2019-02-16 10:05 ` Eli Zaretskii
2019-02-16 11:00 ` Alan Third
2019-02-16 16:28 Keith David Bershatsky
2019-03-08 3:33 Keith David Bershatsky
2019-03-09 9:22 ` Alan Third
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.