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 13:33:44 -0500 Message-ID: <87mz68yebb.fsf@stupidchicken.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1164911684 22903 80.91.229.2 (30 Nov 2006 18:34:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 30 Nov 2006 18:34:44 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 30 19:34:41 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 1Gpqjh-0001bI-Us for ged-emacs-devel@m.gmane.org; Thu, 30 Nov 2006 19:34:18 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gpqjh-0007Vf-FQ for ged-emacs-devel@m.gmane.org; Thu, 30 Nov 2006 13:34:17 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GpqjU-0007S9-UZ for emacs-devel@gnu.org; Thu, 30 Nov 2006 13:34:05 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GpqjS-0007Oq-Rr for emacs-devel@gnu.org; Thu, 30 Nov 2006 13:34:04 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GpqjS-0007ON-Hb for emacs-devel@gnu.org; Thu, 30 Nov 2006 13:34:02 -0500 Original-Received: from [18.19.1.138] (helo=cyd.mit.edu) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GpqjF-0005t6-RW; Thu, 30 Nov 2006 13:33:50 -0500 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id 367774E448; Thu, 30 Nov 2006 13:33:44 -0500 (EST) Original-To: rms@gnu.org, Klaus Zeitler In-Reply-To: (Richard Stallman's message of "Wed\, 29 Nov 2006 22\:20\:47 -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:63148 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? *** 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: