From unknown Sun Jun 22 17:15:24 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#31716 <31716@debbugs.gnu.org> To: bug#31716 <31716@debbugs.gnu.org> Subject: Status: move_it_in_display_line / horizontal scrolling / tab stretch Reply-To: bug#31716 <31716@debbugs.gnu.org> Date: Mon, 23 Jun 2025 00:15:24 +0000 retitle 31716 move_it_in_display_line / horizontal scrolling / tab stretch reassign 31716 emacs submitter 31716 Keith David Bershatsky severity 31716 normal tag 31716 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 04 20:38:47 2018 Received: (at submit) by debbugs.gnu.org; 5 Jun 2018 00:38:47 +0000 Received: from localhost ([127.0.0.1]:33739 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fPzzr-0005MA-2t for submit@debbugs.gnu.org; Mon, 04 Jun 2018 20:38:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54744) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fPzzo-0005Ls-NT for submit@debbugs.gnu.org; Mon, 04 Jun 2018 20:38:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fPzzh-0006Qa-UJ for submit@debbugs.gnu.org; Mon, 04 Jun 2018 20:38:39 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:39630) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fPzzh-0006QT-Qa for submit@debbugs.gnu.org; Mon, 04 Jun 2018 20:38:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45708) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPzzf-0001Sg-Ue for bug-gnu-emacs@gnu.org; Mon, 04 Jun 2018 20:38:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fPzzc-0006PP-Qh for bug-gnu-emacs@gnu.org; Mon, 04 Jun 2018 20:38:35 -0400 Received: from gateway21.websitewelcome.com ([192.185.45.212]:31820) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fPzzc-0006M9-G3 for bug-gnu-emacs@gnu.org; Mon, 04 Jun 2018 20:38:32 -0400 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway21.websitewelcome.com (Postfix) with ESMTP id 10349400CBF9F for ; Mon, 4 Jun 2018 19:38:19 -0500 (CDT) Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id PzzOfHh6KSjJAPzzOfs0JZ; Mon, 04 Jun 2018 19:38:19 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:To:From:Message-ID:Date: Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=4ItycCEeYeet8QuSTpR434Sk7uaPqzvjC5liav7tJ1o=; b=gCe+SdPb9sLxAgRrZs8XG23aZy jyFf4iNwI103dwoXOCwX0C18jUAoWCttsHlH6Qgs0g24rRplSmOTHxDn5Y/h2QFViNagjMvnmlfoE K05vCB6acJyzMhid1/v+LR/QFhv6bjMd9az5TG8jkW9q3M0LAokkew+gz1yCSgN3KhnVJ97t4MB5b /eXihkKsweZHk9JrxMw5SR3YvvogysWJ/c2whSuBiqUGsssL/uvy46wuWVWGZabaziLkjpIv2EPdL RSkiZcbicyHHnmewopJdyYM8VinirNtccK16roBymFl2dBDjebiEF8BBGqQCTx14tvvGsQ71+ie3/ I0XZgn3g==; Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:52975 helo=server.local) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.89_1) (envelope-from ) id 1fPzzO-000rOT-0s for bug-gnu-emacs@gnu.org; Mon, 04 Jun 2018 19:38:18 -0500 Date: Mon, 04 Jun 2018 17:38:17 -0700 Message-ID: From: Keith David Bershatsky To: Emacs Bug Reports Subject: move_it_in_display_line / horizontal scrolling / tab stretch MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 45.48.239.195 X-Source-L: No X-Exim-ID: 1fPzzO-000rOT-0s X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.local) [45.48.239.195]:52975 X-Source-Auth: lawlist X-Email-Count: 1 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) Step 1. Build a new Emacs (master branch) with the function bug-christmas-ghost (below). [E.g., place the new function somewhere appropriate inside of xdisp.c.] Step 2. Launch the newly built Emacs from the terminal so that we can see the STDERR output. Step 3. Paste the following Lisp code into a scratch buffer and evaluate the code. (setq display-line-numbers t) (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 'highlight))) (setq tab-width 8) Step 4. On a new line in the scratch buffer type: C-q TAB Hello Step 5. Place the cursor somewhere on the word "Hello". Step 6. Evaluate: (scroll-left 2) Step 7. Evaluate: (bug-christmas-ghost) OBSERVATIONS: A. When w->hscroll is >= 2 and IT is within the tab STRETCH, move_it_in_display_line_to reports an erroneous it.hpos subsequent to the line numbers. In this example, it.hpos is reported as being either 0 or 5, even though the tab STRETCH visibly begins at an it.hpos of 4 when line numbers are 2 digits wide. B. When w->hscroll is >= 2 and IT is within the tab STRETCH, the latter portion contains one or more it.c ghosts of Christmas future. I.e., the letter "H" gets returned at several locations along the tab STRETCH. EXPECTATIONS / DESIRED BEHAVIOR. i. Loops 7 to 12 should report an it.hpos of 4. ii. Loops 7 to 12 should report an it.c of 9 (aka a tab character). Here is an excerpt from the STDERR output after calling (scroll-left 2) and moving IT by X -- incrementing each loop by font->space_width. [ * * * BEGIN excerpt of STDERR output] [IT.HPOS IS 4, NOT 0.] 7. TAB STRETCH it.c (9) char ( ) it.first_visible_x (14) w->hscroll (2) it.hpos (0) it.first_visible_x (14) it.current_x (7) relative_x (28) new_x (42) font->space_width (7) it.pixel_width (49) it.lnum_pixel_width (28) rc (MOVE_X_REACHED) [IT.HPOS IS 4, NOT 0.] 8. TAB STRETCH it.c (9) char ( ) it.first_visible_x (14) w->hscroll (2) it.hpos (0) it.first_visible_x (14) it.current_x (7) relative_x (35) new_x (49) font->space_width (7) it.pixel_width (49) it.lnum_pixel_width (28) rc (MOVE_X_REACHED) [IT.C IS 9, NOT 72; AND, IT.HPOS IS 4, NOT 5.] 9. TEXT it.c (72) char (H) it.first_visible_x (14) w->hscroll (2) it.hpos (5) it.first_visible_x (14) it.current_x (84) relative_x (42) new_x (56) font->space_width (7) it.pixel_width (7) it.lnum_pixel_width (28) rc (MOVE_X_REACHED) [IT.C IS 9, NOT 72; AND, IT.HPOS IS 4, NOT 5.] 10. TEXT it.c (72) char (H) it.first_visible_x (14) w->hscroll (2) it.hpos (5) it.first_visible_x (14) it.current_x (84) relative_x (49) new_x (63) font->space_width (7) it.pixel_width (7) it.lnum_pixel_width (28) rc (MOVE_X_REACHED) [IT.C IS 9, NOT 72; AND, IT.HPOS IS 4, NOT 5.] 11. TEXT it.c (72) char (H) it.first_visible_x (14) w->hscroll (2) it.hpos (5) it.first_visible_x (14) it.current_x (84) relative_x (56) new_x (70) font->space_width (7) it.pixel_width (7) it.lnum_pixel_width (28) rc (MOVE_X_REACHED) [IT.C IS 9, NOT 72; AND, IT.HPOS IS 4, NOT 5.] 12. TEXT it.c (72) char (H) it.first_visible_x (14) w->hscroll (2) it.hpos (5) it.first_visible_x (14) it.current_x (84) relative_x (63) new_x (77) font->space_width (7) it.pixel_width (7) it.lnum_pixel_width (28) rc (MOVE_X_REACHED) [THIS IS THE REAL LETTER "H"] 13. TEXT it.c (72) char (H) it.first_visible_x (14) w->hscroll (2) it.hpos (5) it.first_visible_x (14) it.current_x (84) relative_x (70) new_x (84) font->space_width (7) it.pixel_width (7) it.lnum_pixel_width (28) rc (MOVE_X_REACHED) [ * * * END excerpt of STDERR output] DEFUN ("bug-christmas-ghost", Fbug_christmas_ghost, Sbug_christmas_ghost, 0, 0, 0, doc: /* Debug the Ghost of Christmas Future. */) (void) { /* ****************************************************************************** PRELIMINARY STUFF ****************************************************************************** */ struct window *w = decode_live_window (selected_window); struct frame *f = XFRAME (w->frame); struct it it; void *itdata = bidi_shelve_cache (); enum move_it_result rc = MOVE_X_REACHED; struct text_pos start_text_position; int count = 0; int new_x = 0; int relative_x = 0; /* ****************************************************************************** START DISPLAY -- w->start ****************************************************************************** */ /* Begin the journey at w->start. */ SET_TEXT_POS_FROM_MARKER (start_text_position, w->start); start_display (&it, w, start_text_position); struct face *face = FACE_FROM_ID (it.f, it.face_id); struct font *font = face->font; /* ****************************************************************************** GO TO THE BEGINNING OF THE CURRENT LINE. ****************************************************************************** */ /* Place the IT on the current line containing PT. */ int voffset = (WINDOW_HEADER_LINE_HEIGHT (w) > 0 && w->output_cursor.vpos > 0) ? w->output_cursor.vpos - 1 : w->output_cursor.vpos; if (voffset > 0) move_it_by_lines (&it, voffset); struct glyph_row *glyph_row = MATRIX_ROW (w->current_matrix, it.vpos); /* ****************************************************************************** MOVE IT OVER EACH CHARACTER ON THE CURRENT LINE. ****************************************************************************** */ while (true) { count += 1; if (new_x > 0) relative_x = new_x - it.first_visible_x; if (ITERATOR_AT_END_OF_LINE_P (&it) || FETCH_BYTE (IT_BYTEPOS (it)) == '\n' || rc == MOVE_POS_MATCH_OR_ZV) break; /* ****************************************************************************** DUMP RELEVANT GLYPH INFORMATION ****************************************************************************** */ if (w->hscroll > 0) { int w_hscroll = w->hscroll; fprintf (stderr, "\n%d. %s\n\ it.c (%d)\n\ char (%s)\n\ it.first_visible_x (%d)\n\ w->hscroll (%d)\n\ it.hpos (%d)\n\ it.first_visible_x (%d)\n\ it.current_x (%d)\n\ relative_x (%d)\n\ new_x (%d)\n\ font->space_width (%d)\n\ it.pixel_width (%d)\n\ it.lnum_pixel_width (%d)\n\ rc (%s)\n", count, (it.c == 0 ? "NOTHING" : it.c == 187 ? "TAB CHARACTER" : it.c == '\t' ? "TAB STRETCH" : "TEXT"), it.c, SSDATA (Fchar_to_string (make_number (it.c))), it.first_visible_x, w_hscroll, it.hpos, it.first_visible_x, it.current_x, relative_x, new_x, font->space_width, it.pixel_width, it.lnum_pixel_width, (rc == MOVE_UNDEFINED ? "MOVE_UNDEFINED" : rc == MOVE_POS_MATCH_OR_ZV ? "MOVE_POS_MATCH_OR_ZV" : rc == MOVE_X_REACHED ? "MOVE_X_REACHED" : rc == MOVE_LINE_CONTINUED ? "MOVE_LINE_CONTINUED" : rc == MOVE_LINE_TRUNCATED ? "MOVE_LINE_TRUNCATED" : rc == MOVE_NEWLINE_OR_CR ? "MOVE_NEWLINE_OR_CR" : "OOPS")); } /* ****************************************************************************** MOVE IT -- INCREMENT == FONT->SPACE_WIDTH ****************************************************************************** */ new_x += font->space_width; rc = move_it_in_display_line_to (&it, ZV, new_x, MOVE_TO_POS | MOVE_TO_X); if (rc == MOVE_LINE_CONTINUED) break; if (it.current_x - it.first_visible_x + font->space_width >= window_box_width (w, TEXT_AREA)) break; } /* ****************************************************************************** REDISPLAY AND DUMP_GLPYH_ROW ****************************************************************************** */ redisplay_internal (); fprintf (stderr, "\n"); dump_glyph_row (glyph_row, it.vpos, 2); bidi_unshelve_cache (itdata, false); return Qnil; } From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 05 10:56:34 2018 Received: (at 31716) by debbugs.gnu.org; 5 Jun 2018 14:56:34 +0000 Received: from localhost ([127.0.0.1]:35303 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fQDNy-0001xp-41 for submit@debbugs.gnu.org; Tue, 05 Jun 2018 10:56:34 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59920) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fQDNv-0001xa-Ia for 31716@debbugs.gnu.org; Tue, 05 Jun 2018 10:56:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fQDNn-0005KB-91 for 31716@debbugs.gnu.org; Tue, 05 Jun 2018 10:56:26 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:45155) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQDNn-0005K6-4b; Tue, 05 Jun 2018 10:56:23 -0400 Received: from [176.228.60.248] (port=3876 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fQDNm-0003UJ-Hk; Tue, 05 Jun 2018 10:56:23 -0400 Date: Tue, 05 Jun 2018 17:56:32 +0300 Message-Id: <83zi099t9b.fsf@gnu.org> From: Eli Zaretskii To: Keith David Bershatsky In-reply-to: (message from Keith David Bershatsky on Mon, 04 Jun 2018 17:38:17 -0700) Subject: Re: bug#31716: move_it_in_display_line / horizontal scrolling / tab stretch References: 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-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 31716 Cc: 31716@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > Date: Mon, 04 Jun 2018 17:38:17 -0700 > From: Keith David Bershatsky > > Step 3. Paste the following Lisp code into a scratch buffer and evaluate the > code. > > (setq display-line-numbers t) > (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 'highlight))) > (setq tab-width 8) > > Step 4. On a new line in the scratch buffer type: C-q TAB Hello > > Step 5. Place the cursor somewhere on the word "Hello". > > Step 6. Evaluate: (scroll-left 2) > > Step 7. Evaluate: (bug-christmas-ghost) > > OBSERVATIONS: > > A. When w->hscroll is >= 2 and IT is within the tab STRETCH, > move_it_in_display_line_to reports an erroneous it.hpos subsequent to the line > numbers. In this example, it.hpos is reported as being either 0 or 5, even > though the tab STRETCH visibly begins at an it.hpos of 4 when line numbers are > 2 digits wide. > > B. When w->hscroll is >= 2 and IT is within the tab STRETCH, the latter > portion contains one or more it.c ghosts of Christmas future. I.e., the letter > "H" gets returned at several locations along the tab STRETCH. > > EXPECTATIONS / DESIRED BEHAVIOR. > > i. Loops 7 to 12 should report an it.hpos of 4. > > ii. Loops 7 to 12 should report an it.c of 9 (aka a tab character). Summary: Your expectations are incorrect, and the code works as expected, AFAICT. Details: There seems to be a misunderstanding of what MOVE_TO_X means for move_it_in_display_line_to. It sounds like you expect it to end up and the new_x coordinate, or report data about what's at new_x on display. But that's not what MOVE_TO_X actually does. In reality, move_it_in_display_line_to cannot move with 1-pixel granularity, it can only move one "display element" at a time. MOVE_TO_X then tells it to stop at a display element whose display _includes_ the coordinate new_x. A display element that begins at X and has pixel width of WX includes the coordinates in [X..X+WX), i.e. X+WX itself is NOT included. So if, for some display element that starts at X, new_x satisfies the inequality X <= new_x < X+WX then move_it_in_display_line_to will stop at X and return MOVE_X_REACHED. On a GUI frame, a TAB produces a single display element: a stretch glyph whose width is the required TAB width. In this case, it's 56 pixels, 14 of which are invisible due to hscroll. With that knowledge in hand, you need to re-asses the results you obtain. Most importantly, it.current_x tells you where did move_it_in_display_line_to actually stop; it doesn't matter where you asked it to stop (which is new_x). > [IT.HPOS IS 4, NOT 0.] > 7. TAB STRETCH > it.c (9) > char ( ) > it.first_visible_x (14) > w->hscroll (2) > it.hpos (0) > it.first_visible_x (14) > it.current_x (7) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > relative_x (28) > new_x (42) > font->space_width (7) > it.pixel_width (49) > it.lnum_pixel_width (28) > rc (MOVE_X_REACHED) > [IT.HPOS IS 4, NOT 0.] > 8. TAB STRETCH > it.c (9) > char ( ) > it.first_visible_x (14) > w->hscroll (2) > it.hpos (0) > it.first_visible_x (14) > it.current_x (7) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > relative_x (35) > new_x (49) > font->space_width (7) > it.pixel_width (49) > it.lnum_pixel_width (28) > rc (MOVE_X_REACHED) > [IT.C IS 9, NOT 72; AND, IT.HPOS IS 4, NOT 5.] > 9. TEXT > it.c (72) > char (H) > it.first_visible_x (14) > w->hscroll (2) > it.hpos (5) > it.first_visible_x (14) > it.current_x (84) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > relative_x (42) > new_x (56) As you see, the first two calls ended up at the same X coordinate of 7, while the 3rd call stopped at X = 84, and first_visible_x is 14. Since 7 < 14, the first two calls stopped on the TAB, and HPOS is zero because the TAB is hscrolled (HPOS is only advanced for X coordinates beyond first_visible_x). The 3rd call stopped at X = 84, which is the coordinate of 'H', because 84 = 56 + 28, the width needed for 56 pixels of the TAB and 28 pixels of the line number. So the 3rd call reports on 'H', and its HPOS is 5, because 4 columns are taken by the line-number digits and one more is taken by the (partially visible) stretch glyph that displays the TAB. Then you see 4 more calls, all of which stop at X = 84, so they all report on 'H': > [IT.C IS 9, NOT 72; AND, IT.HPOS IS 4, NOT 5.] > 10. TEXT > it.c (72) > char (H) > it.first_visible_x (14) > w->hscroll (2) > it.hpos (5) > it.first_visible_x (14) > it.current_x (84) > relative_x (49) > new_x (63) > font->space_width (7) > it.pixel_width (7) > it.lnum_pixel_width (28) > rc (MOVE_X_REACHED) > [IT.C IS 9, NOT 72; AND, IT.HPOS IS 4, NOT 5.] > 11. TEXT > it.c (72) > char (H) > it.first_visible_x (14) > w->hscroll (2) > it.hpos (5) > it.first_visible_x (14) > it.current_x (84) > relative_x (56) > new_x (70) > font->space_width (7) > it.pixel_width (7) > it.lnum_pixel_width (28) > rc (MOVE_X_REACHED) > [IT.C IS 9, NOT 72; AND, IT.HPOS IS 4, NOT 5.] > 12. TEXT > it.c (72) > char (H) > it.first_visible_x (14) > w->hscroll (2) > it.hpos (5) > it.first_visible_x (14) > it.current_x (84) > relative_x (63) > new_x (77) > font->space_width (7) > it.pixel_width (7) > it.lnum_pixel_width (28) > rc (MOVE_X_REACHED) > [THIS IS THE REAL LETTER "H"] > 13. TEXT > it.c (72) > char (H) > it.first_visible_x (14) > w->hscroll (2) > it.hpos (5) > it.first_visible_x (14) > it.current_x (84) > relative_x (70) > new_x (84) > font->space_width (7) > it.pixel_width (7) > it.lnum_pixel_width (28) > rc (MOVE_X_REACHED) IOW, these 'H' are not "ghosts", they are the actual character displayed at the same location X = 84. You just get 4 reports on the same character because move_it_in_display_line_to is at the same coordinate. So I see nothing wrong here. Note that on TTY frames, a TAB is displayed as several separate SPC characters, so in that case you _can_ move by individual increments inside the TAB display. From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 05 10:57:03 2018 Received: (at control) by debbugs.gnu.org; 5 Jun 2018 14:57:03 +0000 Received: from localhost ([127.0.0.1]:35307 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fQDOR-0001z0-Ke for submit@debbugs.gnu.org; Tue, 05 Jun 2018 10:57:03 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59994) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fQDOQ-0001yO-Em for control@debbugs.gnu.org; Tue, 05 Jun 2018 10:57:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fQDOI-0005TV-BJ for control@debbugs.gnu.org; Tue, 05 Jun 2018 10:56:57 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:45158) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQDOI-0005TQ-7r for control@debbugs.gnu.org; Tue, 05 Jun 2018 10:56:54 -0400 Received: from [176.228.60.248] (port=3879 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fQDOH-0003dB-Mg for control@debbugs.gnu.org; Tue, 05 Jun 2018 10:56:54 -0400 Date: Tue, 05 Jun 2018 17:57:04 +0300 Message-Id: <83y3ft9t8f.fsf@gnu.org> From: Eli Zaretskii To: control@debbugs.gnu.org In-reply-to: (message from Keith David Bershatsky on Mon, 04 Jun 2018 17:38:17 -0700) Subject: Re: bug#31716: move_it_in_display_line / horizontal scrolling / tab stretch References: 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-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) tag 31716 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 06 00:18:31 2018 Received: (at 31716) by debbugs.gnu.org; 6 Jun 2018 04:18:31 +0000 Received: from localhost ([127.0.0.1]:35765 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fQPu3-0004Rl-Fj for submit@debbugs.gnu.org; Wed, 06 Jun 2018 00:18:31 -0400 Received: from gateway21.websitewelcome.com ([192.185.45.175]:22338) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fQPu1-0004Rc-B9 for 31716@debbugs.gnu.org; Wed, 06 Jun 2018 00:18:29 -0400 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway21.websitewelcome.com (Postfix) with ESMTP id 9550A400C52E0 for <31716@debbugs.gnu.org>; Tue, 5 Jun 2018 23:18:28 -0500 (CDT) Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id QPu0fK7Od79N3QPu0foHij; Tue, 05 Jun 2018 23:18:28 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:Cc:To:From:Message-ID:Date: Sender:Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=CMK+IZu+4BcwTHzUOinxeVstGbRjQx61rguP9fc0u5U=; b=dyDbXefb0XpbOovAzhQ44DTCLB W56sKz1IAHX8xfKgEHgADoOREVkGnqE5zE2huMt08uz9TeMG8j3MnrHPRLy+l5UOqsJHc9VNw1mvN 1bPY9w2AHGzd3ktdKAVl5rY/Imgtp2g9yFSUw7g71yDYzXl0V8dmJn01TKs4c1cszmQsJx92jaclV uIbJ/BY8XcpxKF/Z9kIbw1KwaUY+NCvmikF1vdoTtXNKLhqCzLjYmQYfqRFuN6hcFAIfSdBug6l3m mk3TdxEilfRQhJdWbu/QNYJMfbQE/rPAd4LSbPDgf3uQu/1rV8K3h+irV4IK5Ieb9FOzABPb9w95a j9CXL84g==; Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:51419 helo=server.local) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.89_1) (envelope-from ) id 1fQPtz-003AP8-Q5; Tue, 05 Jun 2018 23:18:27 -0500 Date: Tue, 05 Jun 2018 21:18:27 -0700 Message-ID: From: Keith David Bershatsky To: Eli Zaretskii Subject: Re: bug#31716: move_it_in_display_line / horizontal scrolling / tab stretch MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 45.48.239.195 X-Source-L: No X-Exim-ID: 1fQPtz-003AP8-Q5 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.local) [45.48.239.195]:51419 X-Source-Auth: lawlist X-Email-Count: 1 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Local-Domain: yes X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 31716 Cc: 31716@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Thank you very much, Eli, for taking the time to provide a detailed explanation regarding how MOVE_TO_X works. I have come up with a way to programmatically deal with this particular situation when all lines are horizontally scrolled, but am still struggling with this situation when only the current line is horizontally scrolled. When only the current line is horizontally scrolled in this particular situation, HPOS is not: it.hpos - window_hscroll_limited (w, f); Instead, HPOS is something like it.hpos - 1 for the fist tab and it becomes more complicated when horizontally scrolling multiple tabs. If it okay, I would suggest/request that bug#31716 remain open for a little bit longer so that I can assemble a minimal working example dealing with horizontal scrolling of the current line when tabs exist. Keith From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 08 01:12:38 2018 Received: (at 31716) by debbugs.gnu.org; 8 Jun 2018 05:12:39 +0000 Received: from localhost ([127.0.0.1]:38604 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fR9hW-0002hs-My for submit@debbugs.gnu.org; Fri, 08 Jun 2018 01:12:38 -0400 Received: from gateway33.websitewelcome.com ([192.185.146.80]:36662) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fR9hU-0002hh-65 for 31716@debbugs.gnu.org; Fri, 08 Jun 2018 01:12:36 -0400 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway33.websitewelcome.com (Postfix) with ESMTP id 91899E914 for <31716@debbugs.gnu.org>; Fri, 8 Jun 2018 00:12:35 -0500 (CDT) Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id R9hTfucCsBcCXR9hTfkzGu; Fri, 08 Jun 2018 00:12:35 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:Cc:To:From:Message-ID:Date: Sender:Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=lC9mucugpSUltnsxqj0eMXi7/a+wYMv1koilB2AvjnY=; b=DbDfgID/5ie3xrYcsD4K9t6SYQ LDebde79yzOKCZMHetQTBnr5GKILNV4zE3ihQhjoJGkQG0Bk/lqfjABv7M2kQvFyaZ6M+jGbMzRRH O4Gj9gQUZaRddDTHEGysPnlX9NXnSKKNyzfO64PTbsnPtzKEWApct7GsWSZssKIYXQWwYYpO5nby9 dTj1InJbXtmjOGaPqY9/1FTW5i8GbMfVA7HRg4lFtIZAROmehTF9cePxTuJfN+bFDn9qVa4mPF/pP CUw9gR/U0D4z18D1hf1nyhs2pfVeLOSF08kUIDyg+k9GVT7RJhdxDO3/G3FeEZaRHGiHl54dfSH3s 5N5d8HcQ==; Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:52601 helo=server.local) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.91) (envelope-from ) id 1fR9hS-004NyA-Ps; Fri, 08 Jun 2018 00:12:34 -0500 Date: Thu, 07 Jun 2018 22:12:34 -0700 Message-ID: From: Keith David Bershatsky To: Eli Zaretskii Subject: Re: bug#31716: move_it_in_display_line / horizontal scrolling / tab stretch MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 45.48.239.195 X-Source-L: No X-Exim-ID: 1fR9hS-004NyA-Ps X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.local) [45.48.239.195]:52601 X-Source-Auth: lawlist X-Email-Count: 1 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Local-Domain: yes X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 31716 Cc: 31716@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) I have had an opportunity to further study your write-up regarding issue 31716, and I really appreciate the help you have given. Using the theory that the increase in current_x translates into a new display element and a corresponding increase in the HPOS once the first visible x is reached, I have come up with (what appears to be) a working method to reliably calculate RELATIVE_X and HPOS when tabs are present with horizontal scrolling. However, I am essentially incrementing font->space_width from the far left of the display elements to the end of the line in order to make all of the relevant determinations along the current line (where I am drawing multiple fake cursors to achieve the visible horizontal line for crosshairs). In a nutshell, the method I am using is somewhat akin to pgrowx in .gdbinit (in that RELATIVE_X is determined based upon the preceding element/determination). The method I am using to calculate RELATIVE_X and HPOS (when tabs are present with horizontal scrolling) is undoubtedly less efficient than using nifty general methods such as: A. RELATIVE_X = it.current_x - it.first_visible_x. B. RELATIVE_X = it.current_x - (window_hscroll_limited (w, f) * frame_char_width). C. HPOS = it.hpos. D. HPOS = t.hpos - window_hscroll_limited (w, f). More efficient ways to calculate RELATIVE_X and HPOS (when tabs are present with horizontal scrolling) can be dealt with in the future on the Emacs devel mailing list since they are not directly related to the reason that #31716 was launched. Please feel free to close out #31716 at your convenience. Thank you again for all your help. Keith From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 08 04:20:08 2018 Received: (at 31716-done) by debbugs.gnu.org; 8 Jun 2018 08:20:08 +0000 Received: from localhost ([127.0.0.1]:38654 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fRCcx-00073L-UC for submit@debbugs.gnu.org; Fri, 08 Jun 2018 04:20:08 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52130) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fRCcw-00072n-AW for 31716-done@debbugs.gnu.org; Fri, 08 Jun 2018 04:20:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRCcn-0006W1-Ay for 31716-done@debbugs.gnu.org; Fri, 08 Jun 2018 04:20:01 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41958) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRCcn-0006Vv-6z; Fri, 08 Jun 2018 04:19:57 -0400 Received: from [176.228.60.248] (port=4839 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fRCcm-0005lM-MU; Fri, 08 Jun 2018 04:19:57 -0400 Date: Fri, 08 Jun 2018 11:19:57 +0300 Message-Id: <83o9glvgeq.fsf@gnu.org> From: Eli Zaretskii To: Keith David Bershatsky In-reply-to: (message from Keith David Bershatsky on Thu, 07 Jun 2018 22:12:34 -0700) Subject: Re: bug#31716: move_it_in_display_line / horizontal scrolling / tab stretch References: 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-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 31716-done Cc: 31716-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > Date: Thu, 07 Jun 2018 22:12:34 -0700 > From: Keith David Bershatsky > Cc: 31716@debbugs.gnu.org > > More efficient ways to calculate RELATIVE_X and HPOS (when tabs are present with horizontal scrolling) can be dealt with in the future on the Emacs devel mailing list since they are not directly related to the reason that #31716 was launched. Please feel free to close out #31716 at your convenience. Done. From unknown Sun Jun 22 17:15:24 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 06 Jul 2018 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator