[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#22873: Can we support multiple cursors?
From: |
Keith David Bershatsky |
Subject: |
bug#22873: Can we support multiple cursors? |
Date: |
Sun, 13 Aug 2017 11:19:30 -0700 |
Dear Eli:
I could use some help/guidance, please.
I have encountered a situation where the Y and VPOS coordinates returned by
`move_it_to` are sometimes out of bounds, and MATRIX_ROW crashes Emacs when
drawing fake cursors that are out of bounds. The solution appears to be a test
for whether Y and VPOS are out of bounds. I would like to use
`window_box_height` to give me essentially the same value as
`window-body-height` with a non-nil PIXELWISE argument. In my case, I have 998
pixels for the window body height as depicted in the diagram of the Emacs
manual:
https://www.gnu.org/software/emacs/manual/html_node/elisp/Window-Sizes.html
The last Y that I am interested in is at 1000 pixels because my
`frame-char-height` -- aka `FRAME_LINE_HEIGHT (XFRAME (w->frame))` -- is 20.
Two pixels are hidden by the mode-line, so the line of text is partially
visible. `count-screen-lines` is not a viable option because using
`vertical-motion` is too slow. The last VPOS that I am interested in is 50 --
again, same thing, partially visible wit
h two pixels hidden underneath the mode-line.
Testing and limiting the drawing of fake cursors with `y <= window_box_height
(w)` gives me mixed results; i.e., sometimes fake cursors are drawn/erased only
up to line 49, but sometimes it works up to line 50 (partially visible). I
think I want to test for whether Y is less than or equal to 1000 and if VPOS is
less than or equal to 50 -- if the test is true, then go ahead and draw fake
cursors up to and including that location.
However, I can foresee situations where there might be mixed line heights on
the visible window, and relying upon the frame character height and window body
height will not be reliable. In a simple case, we can take 1000 divided by 20
and know that the VPOS is 50.
Is there a more reliable test for the last partially visible Y and VPOS within
the window body height? Should I be using pos_visible_p in some capacity here?
Thanks,
Keith