all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
Cc: Klaus Zeitler <kzeitler@lucent.com>, emacs-devel@gnu.org
Subject: Re: [kzeitler@lucent.com: Cursor placement with mouse in long lines with wrapped tab]
Date: Thu, 30 Nov 2006 14:06:52 -0500	[thread overview]
Message-ID: <8764cwpxdf.fsf@stupidchicken.com> (raw)
In-Reply-To: <87mz68yebb.fsf@stupidchicken.com> (Chong Yidong's message of "Thu\, 30 Nov 2006 13\:33\:44 -0500")

>> When I try to set the cursor via mouse-1 on a long line that wraps in a tab
>> character, the placement is off by a few characters depending on the number 
>> of columns of the emacs frame.
>
> I think this is a bug in move_it_to.  When a line ends in a tab, some
> of the glyphs associated with the tab are displayed on the current
> line, and some may be displayed on the next.  In move_it_to, we call
> move_it_in_display_line_to to move to an x position, check if the
> y-position has been reached, and go to the next line if it hasn't.
> For continued lines ending in a tab, at the end of
> move_it_in_display_line_to the value of it->current_x is the x-value
> of the beginning of the final tab, and does not include those tab
> glyphs displayed on this line.  This causes the algorithm to get
> confused.
>
> I propose the following patch.  I think it shouldn't cause any harm in
> other situations, but could someone please review it?

Please consider this patch instead (it won't interfere with other
multi-glyph characters):

*** emacs/src/xdisp.c.~1.1130.~	2006-11-26 16:47:55.000000000 -0500
--- emacs/src/xdisp.c	2006-11-30 14:03:33.000000000 -0500
***************
*** 6828,6834 ****
  	  break;
  
  	case MOVE_LINE_CONTINUED:
! 	  it->continuation_lines_width += it->current_x;
  	  break;
  
  	default:
--- 6828,6835 ----
  	  break;
  
  	case MOVE_LINE_CONTINUED:
! 	  it->continuation_lines_width +=
! 	    (it->c == '\t') ? it->last_visible_x : it->current_x;
  	  break;
  
  	default:

  reply	other threads:[~2006-11-30 19:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-30  3:20 [kzeitler@lucent.com: Cursor placement with mouse in long lines with wrapped tab] Richard Stallman
2006-11-30 18:33 ` Chong Yidong
2006-11-30 19:06   ` Chong Yidong [this message]
2006-11-30 20:01     ` Kim F. Storm

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

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

  git send-email \
    --in-reply-to=8764cwpxdf.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=kzeitler@lucent.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 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.