forked from qt-creator/qt-creator
VcsBaseEditor: Reduce scope of local variable
As suggested by cppcheck. While at it, make it const. Change-Id: I7800291545f8f14f4d939152d9a184da6eadc1f5 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
André Hartmann
parent
b86375ad5d
commit
02d216fa13
@@ -424,11 +424,10 @@ bool UrlTextCursorHandler::findContentsUnderCursor(const QTextCursor &cursor)
|
|||||||
if (cursorForUrl.hasSelection()) {
|
if (cursorForUrl.hasSelection()) {
|
||||||
const QString line = cursorForUrl.selectedText();
|
const QString line = cursorForUrl.selectedText();
|
||||||
const int cursorCol = cursor.columnNumber();
|
const int cursorCol = cursor.columnNumber();
|
||||||
int urlMatchIndex = -1;
|
|
||||||
QRegularExpressionMatchIterator i = m_pattern.globalMatch(line);
|
QRegularExpressionMatchIterator i = m_pattern.globalMatch(line);
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
const QRegularExpressionMatch match = i.next();
|
const QRegularExpressionMatch match = i.next();
|
||||||
urlMatchIndex = match.capturedStart();
|
const int urlMatchIndex = match.capturedStart();
|
||||||
const QString url = match.captured(0);
|
const QString url = match.captured(0);
|
||||||
if (urlMatchIndex <= cursorCol && cursorCol <= urlMatchIndex + url.length()) {
|
if (urlMatchIndex <= cursorCol && cursorCol <= urlMatchIndex + url.length()) {
|
||||||
m_urlData.startColumn = urlMatchIndex;
|
m_urlData.startColumn = urlMatchIndex;
|
||||||
|
|||||||
Reference in New Issue
Block a user