From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: [kzeitler@lucent.com: Cursor placement with mouse in long lines with wrapped tab] Date: Thu, 30 Nov 2006 14:06:52 -0500 Message-ID: <8764cwpxdf.fsf@stupidchicken.com> References: <87mz68yebb.fsf@stupidchicken.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1164913638 30259 80.91.229.2 (30 Nov 2006 19:07:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 30 Nov 2006 19:07:18 +0000 (UTC) Cc: Klaus Zeitler , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 30 20:07:15 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GprFP-0007wp-Oy for ged-emacs-devel@m.gmane.org; Thu, 30 Nov 2006 20:07:04 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GprFP-0004O0-BA for ged-emacs-devel@m.gmane.org; Thu, 30 Nov 2006 14:07:03 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GprFA-0004JS-U7 for emacs-devel@gnu.org; Thu, 30 Nov 2006 14:06:49 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GprF4-00047S-7L for emacs-devel@gnu.org; Thu, 30 Nov 2006 14:06:47 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GprF3-00046f-8N for emacs-devel@gnu.org; Thu, 30 Nov 2006 14:06:41 -0500 Original-Received: from [18.19.1.138] (helo=cyd.mit.edu) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GprF2-0005Dy-8r; Thu, 30 Nov 2006 14:06:40 -0500 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id 2FD5B4E448; Thu, 30 Nov 2006 14:06:52 -0500 (EST) Original-To: rms@gnu.org In-Reply-To: <87mz68yebb.fsf@stupidchicken.com> (Chong Yidong's message of "Thu\, 30 Nov 2006 13\:33\:44 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:63150 Archived-At: >> 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: