Previously, a Return key only inserted a new line when the cursor was at the end of a non-blank line. Otherwise, the cursor is moved to the beginning of the next line. This will reduce accidentally breaking lines in the middle of them. The Control+Return key was implemented to insert a new line always. Upon, using the edit box for a while, I decided to make Return insert a new line when on a blank line.
A problem was corrected when there was a selection, a Return key ignored the selection an moved to the next line instead of replacing the selection. The code was changed to only move to the next line when there is no selection.
There was also a problem when a selection went across two lines, with part of the second line selected. A Control+Return key entered should replace the selected text with a new line, which it did, however, the edit box contents were no redrawn properly where the selected characters on the second line remained selected on the screen. These characters were not actually selected and the were deleted from the document. Must be some sort of bug in the Qt libraries or the libraries routines were not being utilized correctly.
This problem was corrected by replacing the insert text call of a new line with the creation of a new key press event with a Return key, calling the QPlainTextEdit base class key press event handler, deleting the key press event and returning.
[commit a8b9f09778]
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)