Skip to content

Commit

Permalink
when backspacing, needs to keep modified line status
Browse files Browse the repository at this point in the history
if the current line is modified and backspace is used to combine the
line with the previous 'blank' line, the modified line needs to follow
the current line (in other words decremented)

only if the previous line is not empty, should the modified line be
reset, which will be set once the backspace is processed and the cursor
is moved to the previous line (when the previous line is blank, the
ignore change flag is used)
  • Loading branch information
thunder422 committed Feb 10, 2013
1 parent 13443cd commit cd7200d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions editbox.cpp
Expand Up @@ -148,14 +148,22 @@ void EditBox::keyPressEvent(QKeyEvent *event)
{
// previous line blank, mark it for deletion instead
line--;
if (m_lineModified >= 0) // current line modified?
{
// adjust modified line to its new line
m_lineModified--;
}
m_ignoreChange = true;
}
else
{
// line was deleted, do not report as changed
m_lineModified = -1;
}
// indicate line is about to be deleted
emit linesDeleted(line, 1);
// line was deleted, make sure it is not reported changed
m_lineModified = -1;

// is line is blank, combine won't modified previous line
// is line is blank, combine won't modify previous line
if (cursor.atBlockEnd())
{
// prevent backspace setting modified line
Expand Down

0 comments on commit cd7200d

Please sign in to comment.