#32 Fix for rectangular overstrike paste

Program (79)
Nathan Gray

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.



  • Nathan Gray

    Nathan Gray - 2001-12-02

    patch to allow rectangular overstrike paste

  • Eddy De Greef

    Eddy De Greef - 2001-12-02

    Logged In: YES

    This looks fine to me. Deferring the calculation
    is indeed better. I've applied it to CVS.



  • Alexander Mai

    Alexander Mai - 2001-12-03
    • assigned_to: nobody --> edg
    • status: open --> closed-fixed

Log in to post a comment.