summaryrefslogtreecommitdiffstats
path: root/Source/CursesDialog/cmCursesLongMessageForm.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-04-09 12:10:52 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-04-09 12:12:12 (GMT)
commitb8b98c98c3ad861fc4b53fcf3d1216e5a5e19456 (patch)
treeb162eacab5f03c17e2d697cd9b6aa59ef952e776 /Source/CursesDialog/cmCursesLongMessageForm.cxx
parent0f72aba269e95b1709b7ef91f13a874286ab8f86 (diff)
parent60bfaa8fe61fe65b706a304ce4e48f85c13f7c15 (diff)
downloadCMake-b8b98c98c3ad861fc4b53fcf3d1216e5a5e19456.zip
CMake-b8b98c98c3ad861fc4b53fcf3d1216e5a5e19456.tar.gz
CMake-b8b98c98c3ad861fc4b53fcf3d1216e5a5e19456.tar.bz2
Merge topic 'ccmake_incremental_log_display' into release-3.17
60bfaa8fe6 ccmake: Use incremental rendering for the logs e9b36731e9 cmCursesLongMessageForm: Factor out helper to draw message to form Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Robert Maynard <robert.maynard@kitware.com> Merge-request: !4573
Diffstat (limited to 'Source/CursesDialog/cmCursesLongMessageForm.cxx')
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.cxx35
1 files changed, 27 insertions, 8 deletions
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx
index 806e663..afd2b6b 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.cxx
+++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx
@@ -35,6 +35,22 @@ cmCursesLongMessageForm::~cmCursesLongMessageForm()
}
}
+void cmCursesLongMessageForm::UpdateContent(std::string const& output,
+ std::string const& title)
+{
+ this->Title = title;
+
+ if (!output.empty() && this->Messages.size() < MAX_CONTENT_SIZE) {
+ this->Messages.append("\n" + output);
+ form_driver(this->Form, REQ_NEW_LINE);
+ this->DrawMessage(output.c_str());
+ }
+
+ this->UpdateStatusBar();
+ touchwin(stdscr);
+ refresh();
+}
+
void cmCursesLongMessageForm::UpdateStatusBar()
{
int x;
@@ -109,8 +125,6 @@ void cmCursesLongMessageForm::Render(int /*left*/, int /*top*/, int /*width*/,
this->Form = nullptr;
}
- const char* msg = this->Messages.c_str();
-
if (this->Fields[0]) {
free_field(this->Fields[0]);
this->Fields[0] = nullptr;
@@ -123,9 +137,18 @@ void cmCursesLongMessageForm::Render(int /*left*/, int /*top*/, int /*width*/,
this->Form = new_form(this->Fields);
post_form(this->Form);
- int i = 0;
form_driver(this->Form, REQ_BEG_FIELD);
- while (msg[i] != '\0' && i < 60000) {
+ this->DrawMessage(this->Messages.c_str());
+
+ this->UpdateStatusBar();
+ touchwin(stdscr);
+ refresh();
+}
+
+void cmCursesLongMessageForm::DrawMessage(const char* msg) const
+{
+ int i = 0;
+ while (msg[i] != '\0' && i < MAX_CONTENT_SIZE) {
if (msg[i] == '\n' && msg[i + 1] != '\0') {
form_driver(this->Form, REQ_NEW_LINE);
} else {
@@ -138,10 +161,6 @@ void cmCursesLongMessageForm::Render(int /*left*/, int /*top*/, int /*width*/,
} else {
form_driver(this->Form, REQ_BEG_FIELD);
}
-
- this->UpdateStatusBar();
- touchwin(stdscr);
- refresh();
}
void cmCursesLongMessageForm::HandleInput()