Double-click to select current block

This is a Eclipse-like feature, for select enclosing element.
e.g.
int test() {| // Here is the cursor position
    ...
}
When Double-click, we can select the block: {...}
I think this is a useful feature.

Change-Id: I4ca7ed04056176195d1622714effda9079ae0e44
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
Yuchen Deng
2011-10-29 13:09:33 +08:00
committed by Leandro Melo
parent 05d8aeae8d
commit 18b675d32f
4 changed files with 28 additions and 10 deletions

View File

@@ -201,7 +201,7 @@ TextBlockUserData::MatchType TextBlockUserData::checkClosedParenthesis(QTextCurs
}
}
bool TextBlockUserData::findPreviousOpenParenthesis(QTextCursor *cursor, bool select)
bool TextBlockUserData::findPreviousOpenParenthesis(QTextCursor *cursor, bool select, bool onlyInCurrentBlock)
{
QTextBlock block = cursor->block();
int position = cursor->position();
@@ -224,6 +224,8 @@ bool TextBlockUserData::findPreviousOpenParenthesis(QTextCursor *cursor, bool se
}
}
}
if (onlyInCurrentBlock)
return false;
block = block.previous();
}
return false;