vi-mode: Fix register for last inserted text

The register that stores the last inserted text should be (".) instead of ("^). This differs from the last inserted position mark ('^)

Add a test for this register and apply some fixes to make it work:

  • Correctly detect when waiting for a register on normal mode (key ")
  • The InsertStopped mark must not move when on insert mode as this is used to the beginning and end of the insert range
  • Make sure users cannot override it by manually yanking/deleting

The first refactor commit adds a helper static method to validate a character as a register.
This avoids having the conditions spread around the parsing code and simplifies the following one

Also add some small improvements to simplify character matching:

  • helper functions to match a character within an array or a range
  • use constexpr for compile time register constants
  • use Qt::StringLiterals to reduce verbosity

Merge request reports

Loading