From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: Allowing point to be outside the window? Date: Sat, 04 Dec 2021 21:13:40 +0800 Message-ID: <87v904tsvv.fsf@yahoo.com> References: <87ilwd7zaq.fsf.ref@yahoo.com> <87ilwd7zaq.fsf@yahoo.com> <83bl24yaed.fsf@gnu.org> <87sfvg7l51.fsf@yahoo.com> <83zgpowu23.fsf@gnu.org> <87zgpo5tws.fsf@yahoo.com> <83pmqkwi6r.fsf@gnu.org> <87v90c5su6.fsf@yahoo.com> <83o864wg2a.fsf@gnu.org> <87ilwb68ck.fsf@yahoo.com> <83zgpnunfo.fsf@gnu.org> <87fsrf3xmd.fsf@yahoo.com> <83y257ulfp.fsf@gnu.org> <8735ne4e0e.fsf@yahoo.com> <87czmcvcs1.fsf@yahoo.com> <83sfv85y36.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14300"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 04 14:16:21 2021 Return-path: Envelope-to: ged-emacs-devel@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 1mtUto-0003S4-WB for ged-emacs-devel@m.gmane-mx.org; Sat, 04 Dec 2021 14:16:21 +0100 Original-Received: from localhost ([::1]:56112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mtUtn-0005ts-0S for ged-emacs-devel@m.gmane-mx.org; Sat, 04 Dec 2021 08:16:19 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:49820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mtUrR-0004ip-Kn for emacs-devel@gnu.org; Sat, 04 Dec 2021 08:13:53 -0500 Original-Received: from sonic303-21.consmr.mail.ne1.yahoo.com ([66.163.188.147]:34704) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mtUrN-0003Q5-Uf for emacs-devel@gnu.org; Sat, 04 Dec 2021 08:13:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1638623628; bh=zDU7vDM1hOVBuAqdamL73T3mvMl42DEcM2ryCLOZlIo=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=ReMJ5/c0WYQ1z5HGFdZkj6KIuLPI/sckf11GkviQeZca+sYmB668/i0hwVokW60JXs1Msu8wl/hId0fNsTNZ8wmz5JD9bGilqp9j0CLpXJhTXr48WeZIGRMfdb+mKtfDXGxQYrMPRgT7Fj6FVLvL9rCT2d+paUDn3KaP2QvQxCvYIWpa5NVSeD0e2ZOmoG6wlCRsvTviMnU0VB+DnPMvKY26vo2kdMHAbNLm9sQVi5JFRXmL7NmT/CIjbBofQ4NI8mbqwMCLSY8458slNbK3ZCu41moH2hkTcU1AKjA75YMhM3pQxuk6JHVLlf2wLy/neIrkORH8sf7ZFFX14vY8og== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1638623628; bh=wW39ug0JFHyppBAYWfv/PcZSBDRnoJpI7qCZvX7Gl4x=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=COADeZ/LD0wj+fK2SoghTLBNlhLq4zQdV6T7/TJheh4JYgNqJAUxbpP9npY3eQuuE5sz5K+oyEypxdD6S7tgH8PnSCIk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Cq XN90fMzOh6n93mh4SGTfiROdtnYMl_u5TphUh7J1g. X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.ne1.yahoo.com with HTTP; Sat, 4 Dec 2021 13:13:48 +0000 Original-Received: by kubenode513.mail-prod1.omega.sg3.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 1dfcd1ab5d7dbb04a94395aae9b5ef94; Sat, 04 Dec 2021 13:13:46 +0000 (UTC) In-Reply-To: <83sfv85y36.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 04 Dec 2021 14:55:09 +0200") X-Mailer: WebService/1.1.19306 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.188.147; envelope-from=luangruo@yahoo.com; helo=sonic303-21.consmr.mail.ne1.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:280915 Archived-At: Eli Zaretskii writes: > This "allows point to be outside a window" in what situations? If you move point out of the visible area of the window (such as with `goto-char') or if you set the window start but do not force it. > In general, it's hard to provide useful feedback without understanding > the main ideas of the changes. And you didn't add any comments to > help in that. So I'm left to wonder whether some changes I don't > think I understand are just my misunderstanding of your ideas, or your > misunderstanding of the code. I will work on that, sorry. > So just a few random thoughts I had while reading the changes: > Shouldn't set_cursor_from_row be disabled/bypassed in this mode? > > And I don't understand the dance with the cursor_visible_p flag: why > do you reset it at entry and set back before exiting? Isn't the value > of w->cursor enough to tell whether the cursor position was computed > or not? The idea is that if `set_cursor_from_row' returns false (say if the cursor was not found to be in the row), w->cursor_visible will also be set to false. I don't understand why set_cursor_from_row should be disabled though: isn't it responsible for placing the cursor on the display (and as such, isn't it required for the cursor to be displayed when point is _inside_ the window?). >> + if (!keep_point_visible) >> + goto maybe_try_window; >> + >> try_to_scroll: > I don't understand this change. Are you forcibly trying to avoid > calling try_scrolling? If so, why? That function is only loosely > related to scrolling commands; in fact, if you type C-v in "emacs -Q", > you will never see it called. This function is an optimization of a > window's redisplay, and that is needed even in this new mode you are > implementing. Doesn't `try_scrolling' try to constrain point inside if it is too near the end of the window? (And isn't the optimization that tries to decide whether or not to blit the display if appropriate `scrolling_window' in dispextern.c?) >> + maybe_try_window: >> + >> + /* Set the window start position here explicitly if it is outside >> + the accessible portion of the buffer. */ >> + >> + if (CHARPOS (startp) < BEGV >> + || CHARPOS (startp) > ZV) >> + { >> + if (CHARPOS (startp) < BEGV) >> + set_marker_both (w->start, Qnil, BEGV, BEGV_BYTE); >> + else >> + set_marker_both (w->start, Qnil, ZV, ZV_BYTE); >> + >> + SET_TEXT_POS_FROM_MARKER (startp, w->start); >> + >> + /* Run scroll hooks. */ >> + startp = run_window_scroll_functions (window, startp); >> + } >> + >> + /* We invoke try_window and try_window_reusing_current_matrix below, >> + and they manipulate the bidi cache. Save and restore the cache >> + state of our iterator, so we could continue using it after that. */ >> + itdata = bidi_shelve_cache (); > This and the rest of this hunk is a copy of code we have elsewhere, > and I'm not sure I understand why you needed that. I think I can keep it underneath the recenter label, thanks. >> @@ -20875,6 +20956,8 @@ #define GIVE_UP(X) return 0 >> row = row_containing_pos (w, PT, r0, NULL, 0); >> if (row) >> set_cursor_from_row (w, row, current_matrix, 0, 0, 0, 0); >> + else >> + w->cursor_visible_p = false; >> return 1; >> } >> } >> @@ -20915,6 +20998,8 @@ #define GIVE_UP(X) return 0 >> row = row_containing_pos (w, PT, r0, NULL, 0); >> if (row) >> set_cursor_from_row (w, row, current_matrix, 0, 0, 0, 0); >> + else >> + w->cursor_visible_p = false; >> return 2; >> } >> } >> @@ -21152,6 +21237,8 @@ #define GIVE_UP(X) return 0 >> last_unchanged_at_beg_row + 1, 0); >> if (row) >> set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0); >> + else >> + w->cursor_visible_p = false; >> } >> >> /* Start from first_unchanged_at_end_row looking for PT. */ >> @@ -21162,6 +21249,8 @@ #define GIVE_UP(X) return 0 >> if (row) >> set_cursor_from_row (w, row, w->current_matrix, delta, >> delta_bytes, dy, dvpos); >> + else >> + w->cursor_visible_p = false; >> } > Are these really needed? why? I think that's not needed anymore. I will delete it. >> + if (w->cursor_visible_p) >> + { >> + int this_scroll_margin = window_scroll_margin (w, MARGIN_IN_PIXELS); >> + int cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height; > The condition above doesn't check the keep_point_visible flag, why? w->cursor_visible_p should always be true if keep_point_visible is not nil by the time we get there. Thanks.