Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-5605

Pasting text over text in Fakevim does not result in the selected text being removed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Not Evaluated Not Evaluated
    • None
    • Qt Creator 2.3.0-beta
    • FakeVim
    • None
    • 30076b1c97b8246a106f98b2a57a2f3fc3326110

      When text is pasted in vim while a selection is active (in visual mode), the visually highlighted text should be removed, and replaced with the clipboard text.

      Currently in Fakevim, the text is left behind (truly annoying!!).

      In the void FakeVimHandler::Private::pasteText(bool afterCursor) function, after the line:
      const QStringList lines = text.split(QChar('\n'));

      I added the following lines, which fixed the problem:

      if (isVisualCharMode())

      { leaveVisualMode(); m_submode = DeleteSubMode; finishMovement(); afterCursor = false; }

      else if (isVisualLineMode())

      { leaveVisualMode(); m_rangemode = RangeLineMode; yankText(currentRange(), m_register); removeText(currentRange()); handleStartOfLine(); afterCursor = false; }

      else if (isVisualBlockMode())

      { leaveVisualMode(); m_rangemode = RangeBlockMode; yankText(currentRange(), m_register); removeText(currentRange()); setPosition(qMin(position(), anchor())); afterCursor = false; }

      This results in a substantial improvement to the usability of Fakevim.

        For Gerrit Dashboard: QTCREATORBUG-5605
        # Subject Branch Project Status CR V

            hjk hjk
            steventomer Steven Tomer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes