From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#56393: Actually fix the long lines display bug Date: Sat, 09 Jul 2022 14:09:51 +0300 Message-ID: <83edyu35kw.fsf@gnu.org> References: <38c1a31040d2d2bc47ae@heytings.org> <38c1a310405bd4bbe370@heytings.org> <87a69n98yy.fsf@yahoo.com> <38c1a31040f5546dbd3a@heytings.org> <87czej6buq.fsf@gnus.org> <38c1a31040e66d2b273e@heytings.org> <834jzt59jt.fsf@gnu.org> <831qux5806.fsf@gnu.org> <9C70BEF7-08EC-46A0-89D3-547417FA01F8@gmail.com> <83let43xg9.fsf@gnu.org> <83sfna3gzq.fsf@gnu.org> <83fsja36an.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30564"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, larsi@gnus.org, 56393@debbugs.gnu.org To: gregory@heytings.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 09 13:13:57 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oA8PM-0007mp-N9 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Jul 2022 13:13:56 +0200 Original-Received: from localhost ([::1]:51612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oA8PL-0000lj-Ah for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Jul 2022 07:13:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51548) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oA8MY-000790-PG for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2022 07:11:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40020) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oA8MX-0002mi-QD for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2022 07:11:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oA8MX-00026t-Jg for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2022 07:11:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Jul 2022 11:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56393 X-GNU-PR-Package: emacs Original-Received: via spool by 56393-submit@debbugs.gnu.org id=B56393.16573650118029 (code B ref 56393); Sat, 09 Jul 2022 11:11:01 +0000 Original-Received: (at 56393) by debbugs.gnu.org; 9 Jul 2022 11:10:11 +0000 Original-Received: from localhost ([127.0.0.1]:33916 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oA8Lj-00025R-6i for submit@debbugs.gnu.org; Sat, 09 Jul 2022 07:10:11 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:36850) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oA8Li-00025C-3q for 56393@debbugs.gnu.org; Sat, 09 Jul 2022 07:10:10 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:41220) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oA8Lc-0002Ip-DS; Sat, 09 Jul 2022 07:10:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=rU/H/FQl36C8hfBroo3GzgX+swNhBC1n6SdspLEN0U4=; b=fDq9NCpM8Mpm XvS/6q0pdXzzRcrjo0Z/QcE6GFOFqr0nXoZAR2n69oij/vGq1bxKVxumiKfDsD4nbRU+yMrPltusL fYHpoYtwmYSs8Pv2zfvv/HozkTUNwtvDDdBzaPD830ODJ5cpaSwIZZcqRjiOfzFNrqS949XPCzvHA RlL3V7sCK70XKTWZDjKIkB/JkjHFtjVVRqvF/+nJT/7hsWm52Qy5t+J9vsFASGZRGbICZ+HT9AKJy ZRoT5+fPEIs2uElJX/xMpnHdqXrz2KxGPwDmyV7DSAl74jG4e1pOwfO+7sYLy4qOdlntyeWdtPY0L Hd4UrR/uGm8iis+Upvxu8A==; Original-Received: from [87.69.77.57] (port=1216 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oA8LX-0000PC-Mq; Sat, 09 Jul 2022 07:10:01 -0400 In-Reply-To: <83fsja36an.fsf@gnu.org> (message from Eli Zaretskii on Sat, 09 Jul 2022 13:54:24 +0300) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:236501 Archived-At: > Cc: gerd.moellmann@gmail.com, larsi@gnus.org, 56393@debbugs.gnu.org > Date: Sat, 09 Jul 2022 13:54:24 +0300 > From: Eli Zaretskii > > 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 , 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 , 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 , 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 , handlers=XIL(0x90), hfun=0x116d742 ) 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 , 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);