Wednesday, February 13, 2013

Insert Issue And Overwrite Mode

While testing the changes for detecting changed (deleted and inserted) lines when pasting text over a current selection, I noticed that the Shift+Insert sequence, while inserted text from the clipboard, was not being intercepted by the reimplemented paste function.  This was because the key press event handler was only looking for the standard paste key sequence, which is only the Control+V sequence.  So the Insert key code case was modified to look for Shift+Insert sequence in addition to the Control+Shift+Insert sequence.

It was also noticed that just the Insert key was not changing the edit box to overwrite mode from insert mode, which turned out simply to be that the QPlainTextEdit class does not support this by default.  It does support an overwrite mode, so this feature was implemented by using the setOverwrite() function with the argument of the inverse of the current overwrite mode, which causes Insert key (with no key modifiers) to toggle between overwrite and insert modes.

[commit ed503cb558] [commit 0742f7e78d]