Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
3a81f2a3
Commit
3a81f2a3
authored
Aug 04, 2009
by
con
Browse files
Superfluous new lines in application output.
Fix the use of appendPlainText for automatic scrolling.
parent
33bbae9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/projectexplorer/outputwindow.cpp
View file @
3a81f2a3
...
...
@@ -351,22 +351,34 @@ OutputWindow::~OutputWindow()
void
OutputWindow
::
appendOutput
(
const
QString
&
out
)
{
if
(
out
.
endsWith
(
'\n'
))
appendPlainText
(
out
);
appendPlainText
(
out
.
right
(
out
.
length
()
-
1
)
);
else
appendPlainText
(
out
+
'\n'
);
appendPlainText
(
out
);
}
void
OutputWindow
::
appendOutputInline
(
const
QString
&
out
)
{
moveCursor
(
QTextCursor
::
End
);
int
newline
=
out
.
indexOf
(
QLatin1Char
(
'\n'
));
if
(
newline
<
0
)
{
insertPlainText
(
out
);
moveCursor
(
QTextCursor
::
End
);
insertPlainText
(
out
);
// doesn't insert additional '\n' like appendPlainText
return
;
}
insertPlainText
(
out
.
left
(
newline
));
if
(
newline
<
out
.
length
())
appendPlainText
(
out
.
mid
(
newline
+
1
));
int
lastnewline
=
out
.
lastIndexOf
(
QLatin1Char
(
'\n'
));
// make sure that we use appendPlainText to add the last newline
// in the string, so we get automatic scrolling
// and work around the fact that appendPlainText also ensures
// a newline in front of the appended text
if
(
lastnewline
>
0
)
{
moveCursor
(
QTextCursor
::
End
);
insertPlainText
(
out
.
left
(
lastnewline
));
}
appendPlainText
(
""
);
// add the newline
if
(
lastnewline
<
out
.
length
()
-
1
)
{
// newline is not last character
moveCursor
(
QTextCursor
::
End
);
insertPlainText
(
out
.
mid
(
lastnewline
+
1
));
}
}
void
OutputWindow
::
insertLine
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment