While testing the detection of inserted lines when pasting, two issues were discovered. The first was a minor problem where a "connect: no such slot" warning was reported by Qt with the slot that catches the document block (line) count change signal. When this slot function was copied from the Code Editor Example in the documentation, the argument for the number of blocks was removed since it wasn't being used. However, the argument type in the connect call was not changed causing the warning. The argument type was removed from the connect call (it is acceptable to connect a signal with arguments to a slot with no arguments).
The other issue was when using backspace at the beginning of the line, which combines the current line with the previous line. If the current line was marked as modified with a line inserted type (because it is a new line that hasn't been reported yet), then the backspace would report that this line is deleted. However, no line was actually inserted yet, so the next line would have been incorrectly deleted.
To correct this error, backspace now checks for the line inserted modification type and clears the line modified variable and sets the modification type back to line changed instead of emitting that the line was deleted.
One additional issue with this change is that if the current line being combined is blank, then the previous line is not actually modified, so the modified line variable should not be set. To prevent it from getting set, the ignore change flag is set, but then another issue was found.
For some reason, for the delete and backspace key commands, the document change signal is sent twice, which defeated the ignore change mechanism because the document change slot cleared this flag when set. Therefore, instead of clearing this flag in this slot, it is now the setter of this flag's responsibility to clear the flag after the call is made that will trigger the document change signal (the undo and redo functions were already doing this).
[commit 4a2e5f51a7] [commit aa906ee7f4]
Sunday, February 3, 2013
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.)