unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: David Reitter <david.reitter@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 16856@debbugs.gnu.org, Alan Third <alan@idiocy.org>
Subject: bug#16856: 24.3.50;	Cursor leaves garbage in fringe
Date: Sun, 17 Jul 2016 21:41:07 +0900	[thread overview]
Message-ID: <BAEB4D50-58E0-4C40-BD83-3BB493A64699@gmail.com> (raw)
In-Reply-To: <83r3as4gap.fsf@gnu.org>

On Jul 17, 2016, at 9:09 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>  "Because the cursor is drawn without limiting focus to the window
>   box, but it is removed by writing glyph and nothing into the right
>   margin, while focus is applied to the window box, parts of the
>   cursor may remain visible."
> 
> It seems to imply that drawing cursor and erasing it are implemented
> in Aquamacs by two very different code fragments?

I don’t think they’re that different.
I do not know the code there very well, otherwise I would have just fixed the problem.

Is it possible that when drawing the glyph, we call ns_focus with the rectangle returned by ns_get_glyph_string_clip_rect()?
ns_draw_window_cursor() on the other hand focuses via ns_clip_to_row().  It might do so before deleting the cursor (if that’s where the cursor is erased), but that doesn’t matter, because clipping in ns_focus probably isn’t incremental from what it looks like.

>   And if that's true, I understand
> the workaround even less: it limits the _width_ of the cursor, whereas
> the problem is clearly with its coordinates.

No, it increases the width of the clipped rectangle so that the cursor can be erased from wherever it was drawn.
But again, if the cursor type is wider than 2px (on the right hand side of the underlying glyph), we would have to widen the clip box even further.

I’m not sure what the correct solution is here.  If the bar cursor is drawn to the right of the glyph, it’s going to go into the margin or fringe.  If you prevent that even at reasonable cursors like (bar . 2), the cursor is going to look funny on the right hand side.  So, I think we have to  (A)  widen the clipping rectangle to something like max(row_width, glyph_x+glyph_w+min(2, cursor_width)), and (B)  also clip when drawing the cursor so that wide cursors don’t go into the fringe.  I think Alan’s change may have done B already.  Haven’t tested that.  (As for A, I can’t work on it right now and probably don’t know the code well enough to do this right anyway.)




  reply	other threads:[~2016-07-17 12:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <48763C60-1B48-468A-9544-C4A63258CF32@gmail.com>
2016-07-17  8:42 ` bug#16856: 24.3.50; Cursor leaves garbage in fringe Alan Third
2016-07-17 10:41   ` David Reitter
2016-07-17 13:35     ` Alan Third
2016-07-17 12:09   ` Eli Zaretskii
2016-07-17 12:41     ` David Reitter [this message]
2016-07-17 13:26     ` Alan Third
2016-07-17 13:51   ` bug#16856: [PATCH] Prevent bar cursor overwriting next glyph (bug#16856) Alan Third
2016-07-17 22:54     ` David Reitter
2016-07-18 14:26       ` Alan Third
2014-02-23 21:39 bug#16856: 24.3.50; Cursor leaves garbage in fringe (and a request: width of fringes + scroll bar should be full characters) Anders Lindgren
2016-07-17  6:57 ` bug#16856: 24.3.50; Cursor leaves garbage in fringe David Reitter

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=BAEB4D50-58E0-4C40-BD83-3BB493A64699@gmail.com \
    --to=david.reitter@gmail.com \
    --cc=16856@debbugs.gnu.org \
    --cc=alan@idiocy.org \
    --cc=eliz@gnu.org \
    /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).