unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Keith David Bershatsky <esq@lawlist.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Calculating screen relative X when horizontal scrolling.
Date: Wed, 24 Oct 2018 13:40:40 -0700	[thread overview]
Message-ID: <m2r2gf5b93.wl%esq@lawlist.com> (raw)

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 situation.

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/* で広告を取り除きます") ("ミクシィ用フィルタ") ("朝日新聞用フィルタ") ("すべてのページでインラインフレームを取り除きます")

/* *************************************************************************** */
/* MULTIPLE CURSORS */

  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.  */
      ++it->hpos;
    }

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



             reply	other threads:[~2018-10-24 20:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-24 20:40 Keith David Bershatsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-10-20  9:55 Calculating screen relative X when horizontal scrolling Keith David Bershatsky
2018-10-19 20:02 Keith David Bershatsky
2018-10-19 19:58 Keith David Bershatsky
2018-10-20  7:13 ` Eli Zaretskii
2018-10-17 20:43 Keith David Bershatsky
2018-10-19 19:23 ` Eli Zaretskii
2018-10-17 17:54 Keith David Bershatsky
2018-10-16 15:41 Keith David Bershatsky
2018-10-17 16:25 ` Eli Zaretskii
2018-10-15 22:25 Keith David Bershatsky
2018-10-16 14:48 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2r2gf5b93.wl%esq@lawlist.com \
    --to=esq@lawlist.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).