Commit 02b5426b authored by Viktor Kireev's avatar Viktor Kireev
Browse files

Beautifier: Fix text selection for the Uncrustify

Extension of the selection of the text to full lines
does not work correctly if the selection is performed
from the top to the bottom.

Change-Id: I13a1bf9d6e92ebbbfd4f8190fb626dd3aca74686
Reviewed-by: David Schulz's avatarDavid Schulz <>
parent 7643b2cc
......@@ -138,10 +138,13 @@ void Uncrustify::formatSelectedText()
if (tc.hasSelection()) {
// Extend selection to full lines
const int posSelectionEnd = tc.selectionEnd();
const int startPos = tc.position();
// Don't extend the selection if the cursor is at the start of the line
if (tc.positionInBlock() > 0)
const int endPos = tc.position();
m_beautifierPlugin->formatCurrentFile(command(cfgFileName, true), startPos, endPos);
} else if (m_settings->formatEntireFileFallback()) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment