Bugs in Handling/Positioning of Insertion Cursor

The positioning of the insertion cursor has been revised:

The positioning of block cursor and bar cursor will now be handled separately. The bar cursor will be placed at the closest gap, but the block cursor now will be positioned nearest to the clicked position. In old implementation the block cursor has been set to the same position as the bar cursor, but this behavior (probably a bug) is odd, and nasty.

Try this simple code:

The insertion cursor is not visible, it is outside of the screen, but it should be visible at end of first line.

Now try this example:

You will detect the following problems with old implementation (when starting each case at top line):

  1. Move forward with Right key:

    • The insertion cursor is not blinking, or even not visible.

    • You will never see the character ">" at start of line 2 (which contains the yellow frame), even when moving forward many times.

  2. Scroll with Page-Down many times: scrolling the content with Page-Down is not working as expected, you will not reach the third line.

  3. Move the cursor two lines down (with Down key): this is also swallowing the character ">".

All these problems have been fixed. For a proper solution of the problem with page up/down an additional option for command dlineinfo was required:

pathName dlineinfo ?-extents? index

Returns a list with five elements describing the area occupied by the display line containing index. The first two elements of the list give the x and y coordinates of the upper-left corner of the area occupied by the line, the third and fourth elements give the width and height of the area, and the fifth element gives the posi‐ tion of the baseline for the line, measured down from the top of the area. All of this information is measured in pixels. If the current wrap mode is none and the line extends beyond the bound‐ aries of the window, the area returned reflects the entire area of the line, including the portions that are out of the window. If the line is shorter than the full width of the window then the area returned reflects just the portion of the line that is occupied by characters and embedded windows. If the display line containing index is not visible on the screen then the return value is an empty list.

If option -extents is specified then a list of four elements describing the invisible extents of the bounding box will returned, plus a fifth value for the baseline position. If x/y (first/second value) is not zero, then the first x/y pixels are not visible on screen. If width/height (third/fourth value) is not zero, then the last width/height pixels are not visible on screen. If the display line containing index is not visible on the screen then the return value is an empty list.

For symmetry reasons this option has also been added to command bbox. This is the most flexible way for the support of all kinds of cursor/line adjustments.

pathName bbox ?-extents? index

Returns a list of four elements describing the screen area of the character given by index. The first two elements of the list give the x and y coordinates of the upper-left corner of the area occu‐ pied by the character, and the last two elements give the width and height of the area. If the character is only partially visible on the screen, then the return value reflects just the visible part. If the character is not visible on the screen then the return value is an empty list.

If option -extents is specified then a list of four elements describing the invisible extents of the bounding box will returned. If x/y (first/second value) is not zero, then the first x/y pixels are not visible on screen. If width/height (third/fourth value) is not zero, then the last width/height pixels are not visible on screen. If the line which contains this character is not visible on the screen, then the return value is an empty list.