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:
Andre Hartmann
2020-05-16 15:37:47 +02:00
committed by André Hartmann
parent b86375ad5d
commit 02d216fa13

View File

@@ -424,11 +424,10 @@ bool UrlTextCursorHandler::findContentsUnderCursor(const QTextCursor &cursor)
if (cursorForUrl.hasSelection()) {
const QString line = cursorForUrl.selectedText();
const int cursorCol = cursor.columnNumber();
int urlMatchIndex = -1;
QRegularExpressionMatchIterator i = m_pattern.globalMatch(line);
while (i.hasNext()) {
const QRegularExpressionMatch match = i.next();
urlMatchIndex = match.capturedStart();
const int urlMatchIndex = match.capturedStart();
const QString url = match.captured(0);
if (urlMatchIndex <= cursorCol && cursorCol <= urlMatchIndex + url.length()) {
m_urlData.startColumn = urlMatchIndex;