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 13:54:24 +0300 Message-ID: <83fsja36an.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> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32907"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, larsi@gnus.org, 56393@debbugs.gnu.org To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 09 12:56:44 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 1oA88f-0008Kv-9y for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Jul 2022 12:56:41 +0200 Original-Received: from localhost ([::1]:42722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oA88d-0000A8-Dl for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Jul 2022 06:56:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oA874-0007Ac-Er for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2022 06:55:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40006) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oA874-0004uI-4a for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2022 06:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oA874-0001hU-33 for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2022 06:55:02 -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 10:55:02 +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.16573640796506 (code B ref 56393); Sat, 09 Jul 2022 10:55:02 +0000 Original-Received: (at 56393) by debbugs.gnu.org; 9 Jul 2022 10:54:39 +0000 Original-Received: from localhost ([127.0.0.1]:33903 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oA86h-0001gs-3O for submit@debbugs.gnu.org; Sat, 09 Jul 2022 06:54:39 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:32942) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oA86f-0001gf-Qk for 56393@debbugs.gnu.org; Sat, 09 Jul 2022 06:54:38 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:40658) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oA86a-0004qs-AT; Sat, 09 Jul 2022 06:54:32 -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=7NXs2afs7MW6T5hc3u1afwHAS+h6fPiTsK7Yi+/mxQM=; b=QjEsLZKJv5kg e2HV6kyPjNkmLlEHBjArg6yk+w8lRJ1bS8FgjSV953fAhUEvSPgod6jBXh5cypBiPv39SU9hejAG8 7Dp/zo4SQh8N3dU2iANGZyw+bQfidcwVP1F0nE98zJwIeStVIeURUSS7XwWtCj8k7LPxkbGqe4tfs QC0naRQnQXf8BgJRRTC+H3VaUpgPoVl/oonp24pze1m/eMqkuJCKmd3M9DxmfqpFVhqSxZNvUelAi +4gFsbS2Xuoftx7ZMAtW574N4gWp5lpWCMlhtETY70beK9NYg3kHgD2niRsDqOIyDRATSOuQ9VWwI mWxE7EQ+rYI6Om4fBZo6sw==; Original-Received: from [87.69.77.57] (port=4242 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 1oA86Z-0004tG-Pa; Sat, 09 Jul 2022 06:54:32 -0400 In-Reply-To: (message from Gregory Heytings on Sat, 09 Jul 2022 08:56:16 +0000) 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:236498 Archived-At: > Date: Sat, 09 Jul 2022 08:56:16 +0000 > From: Gregory Heytings > cc: gerd.moellmann@gmail.com, larsi@gnus.org, 56393@debbugs.gnu.org > > > . I'm not sure the "restriction" should be computed relative to point: > > that might be OK for redisplaying a window, but for commands that use > > the display code the position with which we call init_iterator and > > start_display might be a better/safer alternative, because that position > > could be very far from point. In any case, get_narrowed_begv receives a > > pointer to a window, so I think it should use the window-point, not PT, > > which is the value of point in the current buffer. > > Okay, I'll do that. 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-> Now move the mouse pointer over the "other" window, the one which still shows xdisp.c at BOB, and turn the mouse wheel to scroll the window towards the end of the buffer. This segfaults: Thread 1 received signal SIGSEGV, Segmentation fault. 0x01054f5c in get_visually_first_element (it=0x82d960) at xdisp.c:8667 8667 && (FETCH_BYTE (it->bidi_it.bytepos - 1) == '\n' (gdb) bt #0 0x01054f5c in get_visually_first_element (it=0x82d960) at xdisp.c:8667 #1 0x010562b8 in next_element_from_buffer (it=0x82d960) at xdisp.c:9125 #2 0x01052b35 in get_next_display_element (it=0x82d960) at xdisp.c:7762 #3 0x0105704a in move_it_in_display_line_to (it=0x82d960, to_charpos=-1, to_x=0, op=MOVE_TO_X) at xdisp.c:9550 #4 0x01059bcb in move_it_to (it=0x82d960, to_charpos=-1, to_x=0, to_y=119, to_vpos=-1, op=3) at xdisp.c:10221 #5 0x01010aac in buffer_posn_from_coords (w=0x7c4ade8, x=0x82e90c, y=0x82e908, pos=0x82e920, object=0x82e938, dx=0x82e91c, dy=0x82e918, width=0x82e914, height=0x82e910) at dispnew.c:5539 #6 0x0117d5a6 in make_lispy_position (f=0x75fd018, x=make_fixnum(492), y=make_fixnum(427), t=1403593421) at keyboard.c:5532 #7 0x0117fae8 in make_lispy_event (event=0x1841100 ) at keyboard.c:6157 #8 0x01179e8d in kbd_buffer_get_event (kbp=0x82ee74, used_mouse_menu=0x82f43f, end_time=0x0) at keyboard.c:4241 #9 0x011721b4 in read_event_from_main_queue (end_time=0x0, local_getcjmp=0x82f190, used_mouse_menu=0x82f43f) at keyboard.c:2238 #10 0x011726d3 in read_decoded_event_from_main_queue (end_time=0x0, local_getcjmp=0x82f190, prev_event=XIL(0), used_mouse_menu=0x82f43f) at keyboard.c:2302 #11 0x01174d50 in read_char (commandflag=1, map=XIL(0xc000000007c46380), prev_event=XIL(0), used_mouse_menu=0x82f43f, end_time=0x0) at keyboard.c:2932 #12 0x0118d435 in read_key_sequence (keybuf=0x82f728, prompt=XIL(0), dont_downcase_last=false, can_return_switch_frame=true, fix_current_buffer=true, prevent_redisplay=false) at keyboard.c:9947 #13 0x0116eeaf in command_loop_1 () at keyboard.c:1391 #14 0x01270266 in internal_condition_case (bfun=0x116e774 , handlers=XIL(0x90), hfun=0x116d742 ) at eval.c:1485 #15 0x0116e1e1 in command_loop_2 (handlers=XIL(0x90)) at keyboard.c:1132 #16 0x0126f0ed in internal_catch (tag=XIL(0xfe70), func=0x116e1aa , arg=XIL(0x90)) at eval.c:1208 #17 0x0116e14c in command_loop () at keyboard.c:1110 #18 0x0116d1a2 in recursive_edit_1 () at keyboard.c:719 #19 0x0116d440 in Frecursive_edit () at keyboard.c:802 #20 0x011683aa in main (argc=2, argv=0xa42a10) at emacs.c:2517 (gdb) p it.bidi_it.bytepos $1 = 1 (gdb) p it.bidi_it.charpos $2 = 1 (gdb) p bob $3 = 1160000 (gdb) p it.narrowed_begv $4 = 1160000 The problem is that narrowed_begv was computed using PT, which doesn't correspond to the window's point, and so the logic in get_visually_first_element backfires.