unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [kzeitler@lucent.com: Cursor placement with mouse in long lines with wrapped tab]
@ 2006-11-30  3:20 Richard Stallman
  2006-11-30 18:33 ` Chong Yidong
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2006-11-30  3:20 UTC (permalink / raw)


Would someone please DTRT and ack?

------- Start of forwarded message -------
Date: Wed, 29 Nov 2006 09:23:49 +0100 (MET)
From: Klaus Zeitler <kzeitler@lucent.com>
To: emacs-pretest-bug@gnu.org
Subject: Cursor placement with mouse in long lines with wrapped tab 
X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed 
	version=3.0.4

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. Using a frame with e.g. 80 columns and the 
following long line with 89 characters (char 81 being a tab) placing the cursor
on the '7' by clicking there with mouse-1 works fine.
- ---
this is a long line with 80 characters followed by a tab and then some more char	12345678
- ---
When I change the frame to 81 columns (the tab in the long line is now wrapped
after 1 char), clicking on the '7' will set the cursor to '6'.
Changing the frame to 82 columns and clicking on '7' will misplace the cursor
by 2 characters and so on.


In GNU Emacs 22.0.50.14 (sparc-sun-solaris2.8, Motif Version 2.1.0)
 of 2006-11-28 on sfsws4
X server distributor `Sun Microsystems, Inc.', version 11.0.6410
configured using `configure '--with-gcc' '--prefix=/vol/freeware/SunOS-5.8/emacs/cvs' '--sharedstatedir=/vol/freeware/SunOS-5.8/emacs/cvs/share' '--with-x-toolkit=motif' '--x-includes=/usr/openwin/include:/usr/local/gnu/include:/opt/exp/gnu/include:/opt/exp/include:/opt/exp/lib/xpm/include' '--x-libraries=/usr/openwin/lib:/usr/local/gnu/lib:/opt/exp/gnu/lib:/opt/exp/lib:/opt/exp/lib/xpm/lib' '--with-pop' 'CC=gcc''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: C
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: identity

Recent input:
<backspace> <backspace> <backspace> <backspace> 2 3 
4 5 6 7 8 9 0 C-a C-k C-y C-y C-y C-y C-y C-y C-y C-y 
<tab> a <backspace> C-x C-g <escape> x f u n d a SPC 
m o SPC <return> <tab> 1 2 3 4 5 6 7 8 9 0 <down-mouse-1> 
<mouse-1> <down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1> 
<down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1> <down-mouse-1> 
<mouse-1> <down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1> 
<down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1> <down-mouse-1> 
<mouse-1> <double-down-mouse-1> <double-mouse-1> <triple-down-mouse-1> 
<triple-mouse-1> <down-mouse-1> <mouse-1> <down-mouse-1> 
<mouse-1> <down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1> 
<down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1> <down-mouse-1> 
<mouse-1> <down-mouse-1> <mouse-1> <right> <right> 
<help-echo> <help-echo> <menu-bar> <help-menu> <re
port-emacs-bug>

Recent messages:
(/usr/local/gnu/cvs/head/bin/emacs -Q)
For information about the GNU Project and its goals, type C-h C-p.
Mark set [8 times]
Loading emacsbug...
Loading regexp-opt...done
Loading emacsbug...done


_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
------- End of forwarded message -------

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [kzeitler@lucent.com: Cursor placement with mouse in long lines with wrapped tab]
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Chong Yidong @ 2006-11-30 18:33 UTC (permalink / raw)
  Cc: emacs-devel

> 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?

*** emacs/src/xdisp.c.~1.1130.~	2006-11-26 16:47:55.000000000 -0500
--- emacs/src/xdisp.c	2006-11-30 13:27:12.000000000 -0500
***************
*** 6828,6834 ****
  	  break;
  
  	case MOVE_LINE_CONTINUED:
! 	  it->continuation_lines_width += it->current_x;
  	  break;
  
  	default:
--- 6828,6834 ----
  	  break;
  
  	case MOVE_LINE_CONTINUED:
! 	  it->continuation_lines_width += it->last_visible_x;
  	  break;
  
  	default:

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [kzeitler@lucent.com: Cursor placement with mouse in long lines with wrapped tab]
  2006-11-30 18:33 ` Chong Yidong
@ 2006-11-30 19:06   ` Chong Yidong
  2006-11-30 20:01     ` Kim F. Storm
  0 siblings, 1 reply; 4+ messages in thread
From: Chong Yidong @ 2006-11-30 19:06 UTC (permalink / raw)
  Cc: Klaus Zeitler, emacs-devel

>> 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:

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [kzeitler@lucent.com: Cursor placement with mouse in long lines with wrapped tab]
  2006-11-30 19:06   ` Chong Yidong
@ 2006-11-30 20:01     ` Kim F. Storm
  0 siblings, 0 replies; 4+ messages in thread
From: Kim F. Storm @ 2006-11-30 20:01 UTC (permalink / raw)
  Cc: Klaus Zeitler, rms, emacs-devel

Chong Yidong <cyd@stupidchicken.com> writes:

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

Looks ok to me.

>
> *** 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:

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-11-30 20:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2006-11-30 20:01     ` Kim F. Storm

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).