Utils: Fix editing in environment widget

In the edge case that the name of one variable starts with the name of
another followed by an underscore, we mistakenly stopped at the former
when searching for the latter in the text widget.

Fixes: QTCREATORBUG-30855
Change-Id: I6decf7805a937d52d25e6c62899ae062f636a2a1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2024-06-05 11:20:23 +02:00
parent 4a9b2deb3e
commit c33decf1b0

View File

@@ -142,7 +142,7 @@ bool NameValueItemsWidget::editVariable(const QString &name, Selection selection
skipWhiteSpace();
if (offset < line.length()) {
QChar nextChar = line.at(offset);
if (nextChar.isLetterOrNumber())
if (nextChar.isLetterOrNumber() || nextChar == '_')
continue;
if (nextChar == '=') {
if (++offset < line.length() && line.at(offset) == '+')