Skip to content

Make paste replace the selection

Jordan Christiansen requested to merge xordspar0/ghex:replace-selection into master

I think this is ready, but I want more time to test before merging it. "More time" might be a week, since I'll be away from my computer this weekend.


When the user pastes, there's a matrix of possible things that can happen:

  • If some data is selected, limit the length of the paste to the selected area.

    • In insert mode, always delete the selection and replace it with the clipboard.
    • In non-insert mode, keep the payload length the same. If the clipboard is shorter than the selection, overwrite the beginning of the selection but leave the end the same. If the clipboard is longer than the selection, truncate the clipboard to the length of the selection.
  • If nothing is selected, don't restrict the length of the paste.

    • In insert mode, just insert the clipboard at the cursor position without replacing anything.
    • In non-insert mode, overwrite as many bytes as necessary to paste the clipboard.

Fixes #62 (closed)

Edited by Jordan Christiansen

Merge request reports