From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Problems with move_it_in_display_line_to X when tabs exist. Date: Sun, 03 Dec 2017 16:29:57 +0200 Message-ID: <83r2sbzxy2.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1512311449 2244 195.159.176.226 (3 Dec 2017 14:30:49 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 3 Dec 2017 14:30:49 +0000 (UTC) Cc: emacs-devel@gnu.org To: Keith David Bershatsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Dec 03 15:30:45 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eLVI5-0000I8-1G for ged-emacs-devel@m.gmane.org; Sun, 03 Dec 2017 15:30:45 +0100 Original-Received: from localhost ([::1]:39134 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLVIA-0004L1-S8 for ged-emacs-devel@m.gmane.org; Sun, 03 Dec 2017 09:30:50 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43085) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLVHc-0004IS-9D for emacs-devel@gnu.org; Sun, 03 Dec 2017 09:30:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eLVHZ-0002lQ-3X for emacs-devel@gnu.org; Sun, 03 Dec 2017 09:30:16 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:37286) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eLVHZ-0002lE-00; Sun, 03 Dec 2017 09:30:13 -0500 Original-Received: from [176.228.60.248] (port=2948 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eLVHY-0007cd-Fu; Sun, 03 Dec 2017 09:30:12 -0500 In-reply-to: (message from Keith David Bershatsky on Sat, 02 Dec 2017 19:38:51 -0800) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:220650 Archived-At: > Date: Sat, 02 Dec 2017 19:38:51 -0800 > From: Keith David Bershatsky > Cc: emacs-devel@gnu.org > > The five faces were set up with the built-in defface macro. I set the buffer-display-table with setq and the following variable: > > (defvar +-buffer-display-table > (let* ( > (display-table (make-display-table)) > (ff-char > (cond > ((eq system-type 'darwin) > ?\U0001D4D5) > ((eq system-type 'windows-nt) > ?\u0046))) > (glyph-form-feed (make-glyph-code ff-char '+-form-feed-face)) > (glyph-pilcrow (make-glyph-code ?\u00B6 '+-newline-face)) > (glyph-space (make-glyph-code ?\u00B7 '+-space-face)) > (glyph-tab (make-glyph-code ?\u00BB '+-tab-face)) > (glyph-tab-spacer (make-glyph-code ?\t '+-tab-spacer-face))) > (aset display-table ?\n `[,glyph-pilcrow ?\n]) > (aset display-table ?\f `[,glyph-form-feed]) > (aset display-table ?\t `[,glyph-tab ,glyph-tab-spacer]) > (aset display-table ?\s `[,glyph-space]) > display-table) > "The `buffer-display-table' that is used when `+-mode' is active.") I cannot reproduce your problem with the latest emacs-26 branch. The above snippet leaves a lot undefined, so I simulated that as follows: (setq buffer-display-table (make-display-table)) (aset buffer-display-table ?\t (vector (make-glyph-code ?\u00BB 'font-lock-warning-face) (make-glyph-code ?\t 'fringe))) (setq word-wrap t) (set tab-width 2) Then I inserted a long line as you described, arranging for its second screen line to start with "xxx" followed by a TAB. Then I emulated your calls to move_it_in_display_line_to by setting visual-order-cursor-movement to t, putting the cursor on the 0xBB character which depicts the TAB, and typing "M-x right-char RET". If I set a breakpoint in xdisp.c:22746, which is here: else if (it.current_x != target_x) move_it_in_display_line_to (&it, ZV, target_x, MOVE_TO_POS | MOVE_TO_X); I see that this call returns with it.current on the stretch glyph following the 0xBB character, and with it.pixel_width set correctly to the width of the stretch glyph. So I think either you call move_it_in_display_line_to in some way that is different from the above, or there's something else you didn't tell in your recipe.