[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Efficiently using MOVE_IT_... to gather a plethora of information.

From: Keith David Bershatsky
Subject: Efficiently using MOVE_IT_... to gather a plethora of information.
Date: Tue, 22 Aug 2017 11:26:25 -0700

I am working on two of my related feature requests:  #17684 (vertical line 
spanning window body height); and, #22873 (multiple fake cursors).

draw_window_cursor is used to create fake cursors with/without glyphs on top -- 
the creation of glyphs is optional by permitting/suppressing the call to 
draw_phys_cursor_glyph.  On OSX, a glyphless fake cursor (i.e., no character on 
top) can be erased by redrawing it with the window background color.  Fake 
cursors with glyphs on top (i.e., a character) are erased with 
erase_phys_cursor.  [I have not yet experimented with erasing a glyphless fake 
cursor on a Windows or X11 platform, but am hoping the concept is similar to 
the approach I use for OSX.]

The combination of glyph/glyphless fake cursors can be used to create a thin 
vertical line spanning the window body height, which has a variety of 
applications; e.g., a vertical line indicating the fill-column, a vertical line 
that tracks the cursor position, etc.

Creating a horizontal line spanning the window body width is easier, and can be 
done with hbar fake cursors and/or overlays (using a combination of 'display 
and 'after-string properties with an :underline).  This application is similar 
to hl-line-mode, except that the :underline can be extended beyond the end of 
the text.

`word-wrap` set to a non-nil value and truncate-lines set to a nil value makes 
the coordinate calculations costly if they are run each command loop.  At the 
present time, I am using an idle timer to calculate/display the vertical line.

The method that I am presently using to calculate coordinates is inefficient 
and relies upon a unique set of circumstances that must exist for everything to 
work.  I am looking for the most efficient approach to calculate certain values 
at three locations of each visible screen line -- `point` and coordinates 

1.  Beginning of each visible screen line.

2.  Ending of each visible screen line.

3.  The current X axis aligned with the cursor on each visible screen line.

This project utilizes the MOVE_IT family within xdisp.c.  We would probably all 
agree that we start the IT at w->start, but where do we go from there is the 
question.  Is the following connect-the-dot the most efficient approach to move 
the IT to each location from window-start to window-end?

1  2  3

4  5  6

7  8  9



reply via email to

[Prev in Thread] Current Thread [Next in Thread]