[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calculating screen relative X when horizontal scrolling.

From: Keith David Bershatsky
Subject: Re: Calculating screen relative X when horizontal scrolling.
Date: Wed, 24 Oct 2018 13:40:40 -0700

I may have located the source of the bug inside move_it_in_display_line_to, 
which is where the wrong it->first-visible_x / it->current_x arise.  I would 
imagine that it->hpos is also wrong.  I have no idea how to fix it, but have 
nevertheless put in some messages demonstrating the numbers desired.

The problem appears to be isolated to simulating what the screen looks like 
using move_it_in_display_line_to.  it->current_x is correct when IT gets to the 
second character after the line numbers, but is wrong for the first character 
to the immediate right of the line numbers.  As far as I can tell, 
it->first_visible_x and it->hpos never straighten themselves out in this 

Just a recap, since the thread has grown a bit in size and the initial thread 
is already somewhat old.  I am using a frame-char-width of 11 for standard 
English letters, and am limiting my testing to (scroll-left 8, 9, 10 and 11), 
with the following test line of miscellaneous characters of varying widths:

("Google の click-tracking コードをリンクの url から取り除きます") ("Google 
検索結果のテーブルを縦方向で揃えて幅を狭めます") ("すべてのページに w3m が扱える name アンカーを追加します") 
("http://*.hp.infoseek.co.jp/* で広告を取り除きます") ("http://linux.ascii24.com/linux/* 
で広告を取り除きます") ("ミクシィ用フィルタ") ("朝日新聞用フィルタ") ("すべてのページでインラインフレームを取り除きます")

/* *************************************************************************** 

  if (new_x > it->first_visible_x)
      /* If we have reached the visible portion of the
         screen line, produce the line number if needed.  */
      if (line_number_pending)

          int saved_x = it->current_x;

          Lisp_Object character = Fchar_to_string (make_number (it->c));
          line_number_pending = false;
          it->current_x = it->first_visible_x;
          maybe_produce_line_number (it);

          if (saved_x + it->lnum_pixel_width ==
                it->current_x + new_x - it->first_visible_x)
            fprintf (stderr, "\nfirst_x (%d) | current_x (%d) of (%s)\n",
                             saved_x - it->pixel_width,
                             saved_x - it->pixel_width + it->lnum_pixel_width,
                             ((!NILP (character)
                               && it->c == 9)
                                 ? "\\t"
                               : (!NILP (character)
                                  && it->c == 10)
                                 ? "\\n"
                               : (!NILP (character)
                                  && it->c != 9
                                  && it->c != 10)
                                 ? SSDATA (character)
                               : "?"));

          it->current_x += new_x - it->first_visible_x;
      /* Glyph is visible.  Increment number of glyphs that
         would be displayed.  */

/* *************************************************************************** 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]