Currently block-paste ignores the insert/overstrike
mode. This can be seen by copying a rectangular
selection and then pasting it in both insert and
overstrike mode. Both modes result in insertions.
There is, however, already code to do rectangular
overstrike pasting in NEdit, as can be seen by making
a rectangular selection and then shift-ctrl-dragging
it with the middle mouse button. This patch changes
the InsertClipboard function in textSel.c to respect
the insert/overstrike mode and call BufOverlayRect,
which is the function used when shift-ctrl-dragging.
BufOverlayRect requires a starting and ending column
for the rectangular overlay. Because calculating the
width of a rectangular selection can be difficult due
to tab expansions and other issues, and because there
already exists a static function in textBuf.c,
textWidth(), to do this calculation, the calculation
is deferred to BufOverlayRect() itself (also in
textBuf.c). I considered this a better solution than
exposing textWidth as a new part of textBuf.c's
interface or duplicating the code in textSel.c. If
there is a better solution to this I would be happy
to hear about it.
Log in to post a comment.