Debugger: Escape special chars in line annotation

By re-using the existing function quoteUnprintable()
and moving their code as escapeUnprintable() to
watchutils.

In contrast to the watches window, where the escaping
can be disabled by the context menu, the line annotations
are always escaped for simplicity.

Change-Id: I76adfd7cd70ec92ff0d7f7ea41fc30ae0057cad0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Andre Hartmann
2021-06-24 16:05:27 +02:00
committed by André Hartmann
parent 4271b3a299
commit a659f445c7
4 changed files with 38 additions and 31 deletions

View File

@@ -414,7 +414,7 @@ static void setValueAnnotationsHelper(BaseTextEditor *textEditor,
const QString expression = expressionUnderCursor(tc);
if (expression.isEmpty())
continue;
const QString value = values.take(expression); // Show value one only once.
const QString value = escapeUnprintable(values.take(expression)); // Show value one only once.
if (value.isEmpty())
continue;
const QString annotation = QString("%1: %2").arg(expression, value);