From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Keith David Bershatsky Newsgroups: gmane.emacs.bugs Subject: bug#22873: Can we support multiple cursors? Date: Sun, 13 Aug 2017 20:20:10 -0700 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Trace: blaine.gmane.org 1502680883 1389 195.159.176.226 (14 Aug 2017 03:21:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 14 Aug 2017 03:21:23 +0000 (UTC) Cc: John Wiegley , Marcin Borkowski , 22873@debbugs.gnu.org, Richard Stallman To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Aug 14 05:21:13 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dh5wC-00080l-R7 for geb-bug-gnu-emacs@m.gmane.org; Mon, 14 Aug 2017 05:21:09 +0200 Original-Received: from localhost ([::1]:39622 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dh5wH-0000eq-FM for geb-bug-gnu-emacs@m.gmane.org; Sun, 13 Aug 2017 23:21:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34197) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dh5w9-0000e1-97 for bug-gnu-emacs@gnu.org; Sun, 13 Aug 2017 23:21:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dh5w6-0002FK-13 for bug-gnu-emacs@gnu.org; Sun, 13 Aug 2017 23:21:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53828) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dh5w5-0002FD-TN for bug-gnu-emacs@gnu.org; Sun, 13 Aug 2017 23:21:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dh5w5-0005Ns-KD for bug-gnu-emacs@gnu.org; Sun, 13 Aug 2017 23:21:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Keith David Bershatsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Aug 2017 03:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22873 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22873-submit@debbugs.gnu.org id=B22873.150268081720679 (code B ref 22873); Mon, 14 Aug 2017 03:21:01 +0000 Original-Received: (at 22873) by debbugs.gnu.org; 14 Aug 2017 03:20:17 +0000 Original-Received: from localhost ([127.0.0.1]:34274 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dh5vN-0005NT-6a for submit@debbugs.gnu.org; Sun, 13 Aug 2017 23:20:17 -0400 Original-Received: from gateway30.websitewelcome.com ([50.116.127.1]:11982) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dh5vL-0005NL-B8 for 22873@debbugs.gnu.org; Sun, 13 Aug 2017 23:20:15 -0400 Original-Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 1D0BA16235 for <22873@debbugs.gnu.org>; Sun, 13 Aug 2017 22:20:13 -0500 (CDT) Original-Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id h5ukdKCmhyM9yh5ukd7vkk; Sun, 13 Aug 2017 22:19:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:Cc:To:From:Message-ID:Date: Sender:Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=F1/aSfoId2ekyC6foCF16Iuc9Yi3YySp/0K7wFQKdQ4=; b=L7/w/QumlmqLwowcinp5SsH6qT Y5ZauPF+5IFqL082INRz7RqDngB1gnGdp/lW4lg+EzPvoDcKs05lb7ByZX6BvNjCWoNPK01VCPcsi gW3PRgiBGaLdoZiHEIuUa7E7Tyc+ZC47E7wN6a4I4Cqur8/TmvmGIS9HbA9Z4PAZG3mNB1MZuDUe3 4Qcn4IhmuWR/LOcz6EYoPgIC0qse2yWYO+jFXqtFwYq2DZ+iqjDRcRXkkcKWK6wFS45DDHaXmD0E6 kIzaLP/fL4TWoKhXL+HuMLwzzwzSRapRJzRWzhPINwbPpvb9bVx9tGm1d+L9HtExWPuMrTLjOK3yi K8lkOj3A==; Original-Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:50834 helo=server.local) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.87) (envelope-from ) id 1dh5vI-001VyV-3L; Sun, 13 Aug 2017 22:20:12 -0500 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 45.48.239.195 X-Exim-ID: 1dh5vI-001VyV-3L X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.local) [45.48.239.195]:50834 X-Source-Auth: lawlist X-Email-Count: 4 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Local-Domain: yes X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:135738 Archived-At: I read through the comments in xdisp.c that immediately precede move_it_to and I also looked at all of it uses within xdisp.c, but I am still unclear how to limit move_it_to the it.last_visible_y. I got the impression that if I put it.last_visible_y as an argument of move_it_to, that `it` would move to that location instead of POS if POS cannot be found. I'd like the function mc_x_y_hpos_vpos to return valid coordinates if POSINT is on the visible window, or -1 for all four coordinates if it is not visible. I'm calling mc_x_y_hpos_vpos late in the redisplay cycle and the START/END arguments "should be" correct. I am unclear as why the Y and VPOS were sometimes out of bounds in a few corner cases (e.g., when I compiled a tex document that had errors in the LaTeX code) -- my best guess i s that START/END may have been wrong because another window was opened displaying the tex compile messages. I was pretty sure that I could substitute window_box_height for window-body-height (with a non-nil PIXELWISE argument), and that is why I phrased that previous comment with a degree of uncertainty. Based on your comment, I now feel better about using window_box_height. I was unaware that my usage of move_it_to may have been incorrect, so that is why I was trying to come up with new ways to workaround coordinates that were out of bounds. If we can fix mc_x_y_hpos_vpos, then there would be no need to perform additional subsequent checks to see whether the values were correct. Drawing and erasing fake cursors is done by temporarily hijacking w->phys_cursor and then calling either erase_phys_cursor or draw_window_cursor. Today, I added "if (it.current_y >= it.last_visible_y) ... goto done" Lisp_Object mc_x_y_hpos_vpos (struct window *w, EMACS_INT posint, EMACS_INT start, EMACS_INT end) { struct it it; void *itdata = bidi_shelve_cache (); struct text_pos pt; int x, y, hpos, vpos; if (posint >= start && posint <= end) { SET_TEXT_POS_FROM_MARKER (pt, w->start); start_display (&it, w, pt); move_it_to (&it, posint, -1, -1, -1, MOVE_TO_POS); if (it.current_y >= it.last_visible_y) { bidi_unshelve_cache (itdata, false); goto done; } x = it.current_x; y = it.current_y; hpos = it.hpos; vpos = it.vpos; bidi_unshelve_cache (itdata, false); } else { done: x = -1; y = -1; hpos = -1; vpos = -1; } return listn (CONSTYPE_HEAP, 4, make_number (x), make_number (y), make_number (hpos), make_number (vpos)); }