unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: gregory@heytings.org
Cc: gerd.moellmann@gmail.com, larsi@gnus.org, 56393@debbugs.gnu.org
Subject: bug#56393: Actually fix the long lines display bug
Date: Sat, 09 Jul 2022 14:09:51 +0300	[thread overview]
Message-ID: <83edyu35kw.fsf@gnu.org> (raw)
In-Reply-To: <83fsja36an.fsf@gnu.org> (message from Eli Zaretskii on Sat, 09 Jul 2022 13:54:24 +0300)

> Cc: gerd.moellmann@gmail.com, larsi@gnus.org, 56393@debbugs.gnu.org
> Date: Sat, 09 Jul 2022 13:54:24 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> Here's one problem caused by using PT in get_narrowed_begv:
> 
>   emacs -Q
>   C-x C-f src/xdisp.c RET
>   C-x 2
>   M->

Here's another:

  emacs -Q
  C-x C-f src/xdisp.c
  C-x *of

After I type 'f' of "*of", Emacs segfaults:

  Thread 1 received signal SIGSEGV, Segmentation fault.
  0x01054f5c in get_visually_first_element (it=0x82d210) at xdisp.c:8667
  8667                   && (FETCH_BYTE (it->bidi_it.bytepos - 1) == '\n'
  (gdb) bt
  #0  0x01054f5c in get_visually_first_element (it=0x82d210) at xdisp.c:8667
  #1  0x010562b8 in next_element_from_buffer (it=0x82d210) at xdisp.c:9125
  #2  0x01052b35 in get_next_display_element (it=0x82d210) at xdisp.c:7762
  #3  0x0105704a in move_it_in_display_line_to (it=0x82d210, to_charpos=48949,
      to_x=0, op=(MOVE_TO_X | MOVE_TO_POS)) at xdisp.c:9550
  #4  0x01059bcb in move_it_to (it=0x82d210, to_charpos=48949, to_x=-1,
      to_y=543, to_vpos=-1, op=10) at xdisp.c:10221
  #5  0x01038364 in pos_visible_p (w=0x75fd230, charpos=48949, x=0x82e1fc,
      y=0x82e1f8, rtop=0x82e20c, rbot=0x82e208, rowh=0x82e204, vpos=0x82e200)
      at xdisp.c:1730
  #6  0x010c9fcc in Fpos_visible_in_window_p (pos=XIL(0), window=XIL(0),
      partially=XIL(0x30)) at window.c:2000
  #7  0x0127608d in funcall_subr (subr=0x173c8c0 <Spos_visible_in_window_p>,
      numargs=3, args=0x68b0240) at eval.c:3000
  #8  0x012e9238 in exec_byte_code (fun=XIL(0xa000000005db8a1c),
      args_template=768, nargs=3, args=0x68b0200) at bytecode.c:809
  #9  0x012765d1 in fetch_and_exec_byte_code (fun=XIL(0xa000000005e00f1c),
      args_template=512, nargs=2, args=0x82eb60) at eval.c:3045
  #10 0x01276b30 in funcall_lambda (fun=XIL(0xa000000005e00f1c), nargs=2,
      arg_vector=0x82eb60) at eval.c:3117
  #11 0x01275ae6 in funcall_general (fun=XIL(0xa000000005e00f1c), numargs=2,
      args=0x82eb60) at eval.c:2908
  #12 0x01275e42 in Ffuncall (nargs=3, args=0x82eb58) at eval.c:2958
  #13 0x0126526a in Ffuncall_interactively (nargs=3, args=0x82eb58)
      at callint.c:291
  #14 0x01276482 in funcall_subr (subr=0x1747440 <Sfuncall_interactively>,
      numargs=3, args=0x82eb58) at eval.c:3023
  #15 0x01275a7f in funcall_general (fun=XIL(0xa000000001747440), numargs=3,
      args=0x82eb58) at eval.c:2904
  #16 0x01275e42 in Ffuncall (nargs=4, args=0x82eb50) at eval.c:2958
  #17 0x01274d39 in Fapply (nargs=3, args=0x82ecc8) at eval.c:2629
  #18 0x0126599c in Fcall_interactively (function=XIL(0x4570a8c),
      record_flag=XIL(0), keys=XIL(0xa000000007a59e70)) at callint.c:384
  #19 0x0127608d in funcall_subr (subr=0x1747480 <Scall_interactively>,
      numargs=3, args=0x68b0078) at eval.c:3000
  #20 0x012e9238 in exec_byte_code (fun=XIL(0xa000000005dff734),
      args_template=1025, nargs=1, args=0x82f5b0) at bytecode.c:809
  #21 0x012765d1 in fetch_and_exec_byte_code (fun=XIL(0xa000000005dff734),
      args_template=1025, nargs=1, args=0x82f5a8) at eval.c:3045
  #22 0x01276b30 in funcall_lambda (fun=XIL(0xa000000005dff734), nargs=1,
      arg_vector=0x82f5a8) at eval.c:3117
  #23 0x01275ae6 in funcall_general (fun=XIL(0xa000000005dff734), numargs=1,
      args=0x82f5a8) at eval.c:2908
  #24 0x01275e42 in Ffuncall (nargs=2, args=0x82f5a0) at eval.c:2958
  #25 0x0116b1ce in call1 (fn=XIL(0x4440), arg1=XIL(0x4570a8c)) at lisp.h:3239
  #26 0x0116f400 in command_loop_1 () at keyboard.c:1510
  #27 0x01270266 in internal_condition_case (bfun=0x116e774 <command_loop_1>,
      handlers=XIL(0x90), hfun=0x116d742 <cmd_error>) at eval.c:1485
  #28 0x0116e1e1 in command_loop_2 (handlers=XIL(0x90)) at keyboard.c:1132
  #29 0x0126f0ed in internal_catch (tag=XIL(0xfe70),
      func=0x116e1aa <command_loop_2>, arg=XIL(0x90)) at eval.c:1208
  #30 0x0116e14c in command_loop () at keyboard.c:1110
  #31 0x0116d1a2 in recursive_edit_1 () at keyboard.c:719
  #32 0x0116d440 in Frecursive_edit () at keyboard.c:802
  #33 0x011683aa in main (argc=2, argv=0xa42a10) at emacs.c:2517

  Lisp Backtrace:
  "pos-visible-in-window-p" (0x68b0240)
  "pos-visible-in-window-group-p" (0x68b01e8)
  "isearch-update" (0x68b0198)
  "isearch-search-and-update" (0x68b0170)
  "isearch-process-search-string" (0x68b0130)
  "isearch-process-search-char" (0x68b00e0)
  "isearch-printing-char" (0x82eb60)
  "funcall-interactively" (0x82eb58)
  "call-interactively" (0x68b0078)
  "command-execute" (0x82f5a8)
  (gdb) p it->current
  $1 = {
    pos = {
      charpos = 1,
      bytepos = 1
    },
    overlay_string_index = -1,
    string_pos = {
      charpos = -1,
      bytepos = -1
    },
    dpvec_index = -1
  }
  (gdb) p it->bidi_it.bytepos
  $2 = 1
  (gdb) p bob
  $3 = 20000
  (gdb) p it->narrowed_begv
  $4 = 20000

This is because start_display was called to start from the window's
start point:

  #5  0x01038364 in pos_visible_p (w=0x75fd230, charpos=48949, x=0x82e1fc,
      y=0x82e1f8, rtop=0x82e20c, rbot=0x82e208, rowh=0x82e204, vpos=0x82e200)
      at xdisp.c:1730
  1730      move_it_to (&it, charpos, -1, it.last_visible_y - 1, -1,
  (gdb) p top
  $6 = {
    charpos = 1,
    bytepos = 1
  }
  (gdb) p PT
  $7 = 48949
  (gdb) p w->start
  $8 = XIL(0xa00000000760a9d0)
  (gdb) xmarker
  $9 = (struct Lisp_Marker *) 0x760a9d0
  (gdb) p *$
  $10 = {
    header = {
      size = 1124081664
    },
    buffer = 0x76be1b8,
    need_adjustment = 0,
    insertion_type = 0,
    next = 0x7621158,
    charpos = 1,
    bytepos = 1
  }

In the source code it looks like this:

  SET_TEXT_POS_FROM_MARKER (top, w->start);
  [...]
  start_display (&it, w, top);
  move_it_to (&it, charpos, -1, it.last_visible_y - 1, -1,
	      (charpos >= 0 ? MOVE_TO_POS : 0) | MOVE_TO_Y);





  reply	other threads:[~2022-07-09 11:09 UTC|newest]

Thread overview: 205+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-05  8:49 bug#56393: Actually fix the long lines display bug Gregory Heytings
2022-07-05  9:28 ` Gregory Heytings
2022-07-05  9:58   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-05 10:17     ` Gregory Heytings
2022-07-05 11:24       ` Lars Ingebrigtsen
2022-07-05 12:16         ` Gregory Heytings
2022-07-05 12:59           ` Gerd Möllmann
2022-07-07 11:29             ` Gerd Möllmann
2022-07-07 13:36               ` Eli Zaretskii
2022-07-07 14:10                 ` Eli Zaretskii
2022-07-08  5:49                   ` Gerd Möllmann
2022-07-08  6:55                     ` Eli Zaretskii
2022-07-08  7:01                       ` Gerd Möllmann
2022-07-08 21:41                       ` Gregory Heytings
2022-07-09  7:03                         ` Eli Zaretskii
2022-07-09  8:56                           ` Gregory Heytings
2022-07-09  9:20                             ` Eli Zaretskii
2022-07-09  9:23                               ` Eli Zaretskii
2022-07-09  9:32                                 ` Gregory Heytings
2022-07-09  9:30                               ` Eli Zaretskii
2022-07-09  9:49                               ` Gregory Heytings
2022-07-09 10:01                                 ` Eli Zaretskii
2022-07-09 10:50                                   ` Gregory Heytings
2022-07-09 11:16                                     ` Eli Zaretskii
2022-07-09 11:48                                       ` Gregory Heytings
2022-07-09 11:59                                         ` Eli Zaretskii
2022-07-09 12:07                                           ` Gregory Heytings
2022-07-09 12:34                                             ` Eli Zaretskii
2022-07-09 12:36                                               ` Gregory Heytings
2022-07-09 12:09                                           ` Ihor Radchenko
2022-07-09 12:37                                             ` Eli Zaretskii
2022-07-09 10:54                             ` Eli Zaretskii
2022-07-09 11:09                               ` Eli Zaretskii [this message]
2022-07-09 11:12                               ` Gregory Heytings
2022-07-09 11:20                                 ` Gregory Heytings
2022-07-09 12:29                                   ` Lars Ingebrigtsen
2022-07-09 12:38                                     ` Gregory Heytings
2022-07-16 19:39                                       ` Gregory Heytings
2022-07-17 15:21                                         ` Eli Zaretskii
2022-07-17 15:37                                           ` Gregory Heytings
2022-07-17 16:00                                             ` Eli Zaretskii
2022-07-18 10:19                                               ` Gregory Heytings
2022-07-18 12:20                                                 ` Eli Zaretskii
2022-07-18 12:58                                                   ` Gregory Heytings
2022-07-18 13:33                                                     ` Eli Zaretskii
2022-07-18 14:00                                                       ` Gregory Heytings
2022-07-18 14:10                                                         ` Gregory Heytings
2022-07-18 14:22                                                           ` Eli Zaretskii
2022-07-18 14:34                                                             ` Gregory Heytings
2022-07-18 16:06                                                             ` Gregory Heytings
2022-07-18 16:21                                                               ` Gregory Heytings
2022-07-18 17:04                                                                 ` Eli Zaretskii
2022-07-18 17:07                                                                   ` Gregory Heytings
2022-07-18 17:09                                                                     ` Eli Zaretskii
2022-07-18 18:33                                                                       ` Gregory Heytings
2022-07-18 16:48                                                               ` Eli Zaretskii
2022-07-18 17:11                                                                 ` Gregory Heytings
2022-07-18 17:19                                                                   ` Eli Zaretskii
2022-07-18 18:17                                                                     ` Gregory Heytings
2022-07-18 18:26                                                                   ` Gregory Heytings
2022-07-18 18:56                                                                     ` Eli Zaretskii
2022-07-18 20:14                                                                       ` Gregory Heytings
2022-07-19  2:34                                                                         ` Eli Zaretskii
2022-07-19  5:39                                                                           ` Gregory Heytings
2022-07-19 12:00                                                                             ` Eli Zaretskii
2022-07-19 12:07                                                                               ` Gerd Möllmann
2022-07-19 12:49                                                                               ` Gregory Heytings
2022-07-19 13:16                                                                                 ` Eli Zaretskii
2022-07-19 13:42                                                                                   ` Gregory Heytings
2022-07-19 13:56                                                                                     ` Eli Zaretskii
2022-07-19 14:06                                                                                       ` Gregory Heytings
2022-07-19 14:15                                                                                         ` Lars Ingebrigtsen
2022-07-19 14:24                                                                                           ` Gregory Heytings
     [not found]                                                                                           ` <364167b2-83e-c5af-1981-221d53e33ce6@heytings.org>
2022-07-19 21:55                                                                                             ` Gregory Heytings
2022-07-19 14:19                                                                                         ` Eli Zaretskii
2022-07-19 14:33                                                                                           ` Gregory Heytings
2022-07-19 16:14                                                                                             ` Eli Zaretskii
2022-07-19 21:40                                                                                               ` Gregory Heytings
2022-07-20 12:07                                                                                                 ` Eli Zaretskii
2022-07-20 13:06                                                                                                   ` Gregory Heytings
2022-07-20 13:23                                                                                                     ` Eli Zaretskii
2022-07-20 13:42                                                                                                       ` Gregory Heytings
2022-07-20 15:54                                                                                                         ` Eli Zaretskii
2022-07-20 17:33                                                                                                           ` Gregory Heytings
2022-07-21  6:32                                                                                                             ` Eli Zaretskii
2022-07-21  7:39                                                                                                               ` Gregory Heytings
2022-07-21  7:49                                                                                                                 ` Gregory Heytings
2022-07-21  8:00                                                                                                                   ` Eli Zaretskii
2022-07-21  7:56                                                                                                                 ` Eli Zaretskii
2022-07-21  8:20                                                                                                                   ` Gregory Heytings
2022-07-21  8:58                                                                                                                     ` Eli Zaretskii
2022-07-21  9:00                                                                                                                       ` Gregory Heytings
2022-07-21  9:18                                                                                                                         ` Lars Ingebrigtsen
2022-07-21 11:56                                                                                                                           ` Gregory Heytings
2022-07-21 12:22                                                                                                                             ` Eli Zaretskii
     [not found]                                                                               ` <bce7aad8-6872-97ec-77ac-6a593ff66a27@heytings.org>
2022-07-19 12:57                                                                                 ` Gregory Heytings
2022-07-21  9:42                                                                       ` Eli Zaretskii
2022-07-08  5:47                 ` Gerd Möllmann
2022-07-08  5:56                   ` Eli Zaretskii
2022-07-08  6:25                     ` Gerd Möllmann
2022-07-08  7:19                       ` Eli Zaretskii
2022-07-07 18:38               ` Gregory Heytings
2022-07-08  5:59                 ` Gerd Möllmann
2022-07-05 12:54       ` Eli Zaretskii
2022-07-05 13:53         ` Gregory Heytings
2022-07-05 14:14           ` Eli Zaretskii
2022-07-05 14:30             ` Gregory Heytings
2022-07-05 15:21               ` Robert Pluim
2022-07-05 15:46               ` Eli Zaretskii
2022-07-05 16:21                 ` Gregory Heytings
2022-07-05 16:34                   ` Eli Zaretskii
2022-07-05 23:09                     ` Lars Ingebrigtsen
2022-07-05 23:12                       ` Gregory Heytings
2022-07-06 12:29                         ` Eli Zaretskii
2022-07-06 13:01                           ` Gregory Heytings
2022-07-06 13:25                             ` Eli Zaretskii
2022-07-06 13:56                               ` Gregory Heytings
2022-07-06 14:09                                 ` Eli Zaretskii
2022-07-06 14:41                                   ` Gregory Heytings
2022-07-06 16:19                                     ` Eli Zaretskii
2022-07-06 16:57                                       ` Gregory Heytings
2022-07-06 17:50                                         ` Eli Zaretskii
2022-07-07  0:28                                           ` Ihor Radchenko
2022-07-07  5:43                                             ` Eli Zaretskii
2022-07-07  0:38                                           ` Gregory Heytings
2022-07-07  5:53                                             ` Eli Zaretskii
2022-07-07  8:23                                               ` Gregory Heytings
2022-07-07 10:10                                                 ` Eli Zaretskii
2022-07-07 18:08                                                   ` Gregory Heytings
2022-07-09  6:20                                                   ` Eli Zaretskii
2022-07-09  8:24                                                     ` Gregory Heytings
2022-07-09  9:13                                                       ` Eli Zaretskii
2022-07-09  9:39                                                         ` Gregory Heytings
2022-07-09  9:59                                                           ` Eli Zaretskii
2022-07-09 10:20                                                             ` Gregory Heytings
2022-07-09 10:41                                                               ` Eli Zaretskii
2022-07-09 11:09                                                                 ` Gregory Heytings
2022-07-09 11:18                                                                   ` Eli Zaretskii
2022-07-09 11:38                                                                     ` Gregory Heytings
2022-07-09 11:48                                                                       ` Eli Zaretskii
2022-07-09 12:01                                                                         ` Gregory Heytings
2022-07-09 12:24                                                                           ` Eli Zaretskii
2022-07-09 12:31                                                                             ` Gregory Heytings
2022-07-07 14:25                                             ` Drew Adams
2022-07-07 15:58                                               ` Eli Zaretskii
2022-07-07 17:50                                                 ` Eli Zaretskii
2022-07-07 18:46                                                   ` Gregory Heytings
2022-07-07 19:05                                                     ` Eli Zaretskii
2022-07-07 18:49                                               ` Gregory Heytings
2022-07-06 13:34                             ` Stefan Kangas
2022-07-06 14:10                               ` Gregory Heytings
2022-07-06 14:37                                 ` Stefan Kangas
2022-07-06 14:47                                   ` Gregory Heytings
2022-07-06 15:03                                     ` Stefan Kangas
2022-07-06 15:31                                       ` Gregory Heytings
2022-07-06 15:50                                   ` Eli Zaretskii
2022-07-05 23:10                     ` Gregory Heytings
2022-07-06  9:49                       ` Gerd Möllmann
2022-07-06 10:21                         ` Gregory Heytings
2022-07-06 11:31                       ` Lars Ingebrigtsen
2022-07-06 12:13                         ` Gregory Heytings
2022-07-06 12:44                           ` Gregory Heytings
2022-07-07  7:48                             ` Lars Ingebrigtsen
2022-07-06 12:50                         ` Eli Zaretskii
2022-07-06 13:16                         ` Phil Sainty
2022-07-06 13:45                           ` Gregory Heytings
2022-07-06 14:05                             ` Phil Sainty
2022-07-06 12:39                       ` Eli Zaretskii
2022-07-06 13:06                         ` Gregory Heytings
2022-07-06 13:32                           ` Eli Zaretskii
2022-07-06 14:05                             ` Gregory Heytings
2022-07-06 14:13                               ` Eli Zaretskii
2022-07-06 14:27                                 ` Gregory Heytings
2022-07-06 16:53                                   ` Eli Zaretskii
2022-07-06 17:17                                     ` Gregory Heytings
2022-07-06 17:30                                       ` Eli Zaretskii
2022-07-06 21:53                                         ` Gregory Heytings
2022-07-07  7:47                               ` Lars Ingebrigtsen
2022-07-18  9:44 ` bug#56393: Soon also looking at your branch Gerd Möllmann
2022-07-18 10:11   ` Michael Albinus
2022-07-18 10:26     ` Gerd Möllmann
2022-07-18 11:43       ` Michael Albinus
2022-07-18 12:15         ` Gerd Möllmann
2022-07-18 12:19           ` Michael Albinus
2022-07-18 10:49   ` Gregory Heytings
2022-07-19  8:21     ` bug#56393: Actually fix the long lines display bug Gerd Möllmann
2022-07-19  8:53       ` Gregory Heytings
2022-07-19  8:58         ` Gregory Heytings
2022-07-19  9:31           ` bug#56393: Resetting long_line_optimization_p to 0 Gerd Möllmann
2022-07-19  9:51             ` Gregory Heytings
2022-07-19 11:20               ` Gerd Möllmann
2022-07-20  6:58                 ` bug#56393: Actually fix the long lines display bug Gerd Möllmann
2022-07-20  9:13                   ` Gregory Heytings
2022-07-19 12:21           ` Eli Zaretskii
2022-07-19  9:17         ` bug#56393: Auto narrowing autside of redisplay Gerd Möllmann
2022-07-19  9:51           ` Gregory Heytings
2022-07-19 10:56             ` bug#56393: Actually fix the long lines display bug Gerd Möllmann
2022-07-19  9:25         ` bug#56393: Turn on narrowing in redisplay_window Gerd Möllmann
2022-07-19  9:52           ` Gregory Heytings
2022-07-19 11:26             ` Gerd Möllmann
2022-07-19 12:43               ` Eli Zaretskii
2022-07-20  6:30                 ` bug#56393: Actually fix the long lines display bug Gerd Möllmann
2022-07-20  9:08                   ` Gregory Heytings
2022-07-19 12:48         ` Eli Zaretskii
2022-07-20  6:32           ` Gerd Möllmann

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=83edyu35kw.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=56393@debbugs.gnu.org \
    --cc=gerd.moellmann@gmail.com \
    --cc=gregory@heytings.org \
    --cc=larsi@gnus.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).