1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

ccmake: redirect stdout/stderr to the displayed logs

Use cmSystemTools to report some messages.
These should now be caught and displayed properly,
both in ccmake and cmake-gui

Avoid log display flickering during processing
- Don't clear the screen each time the long message form is rendered.
  It always renders the whole screen again so clearing it only causes
  flickering.
- Add scroll down capabilities to the long message form so that it can
  draw itself directly in the correct state. This removes the need to
  programatically scroll down just after that also caused flickering.

Fixes #19882
Fixes #13288
This commit is contained in:
Sylvain Joubert
2019-11-05 17:07:42 +01:00
parent a10e11fd7c
commit 88cfef0821
5 changed files with 53 additions and 37 deletions

View File

@@ -17,7 +17,9 @@ inline int ctrl(int z)
}
cmCursesLongMessageForm::cmCursesLongMessageForm(
std::vector<std::string> const& messages, const char* title)
std::vector<std::string> const& messages, const char* title,
ScrollBehavior scrollBehavior)
: Scrolling(scrollBehavior)
{
// Append all messages into on big string
this->Messages = cmJoin(messages, "\n");
@@ -109,8 +111,6 @@ void cmCursesLongMessageForm::Render(int /*left*/, int /*top*/, int /*width*/,
const char* msg = this->Messages.c_str();
curses_clear();
if (this->Fields[0]) {
free_field(this->Fields[0]);
this->Fields[0] = nullptr;
@@ -133,7 +133,11 @@ void cmCursesLongMessageForm::Render(int /*left*/, int /*top*/, int /*width*/,
}
i++;
}
form_driver(this->Form, REQ_BEG_FIELD);
if (this->Scrolling == ScrollBehavior::ScrollDown) {
form_driver(this->Form, REQ_END_FIELD);
} else {
form_driver(this->Form, REQ_BEG_FIELD);
}
this->UpdateStatusBar();
touchwin(stdscr);
@@ -174,13 +178,3 @@ void cmCursesLongMessageForm::HandleInput()
wrefresh(stdscr);
}
}
void cmCursesLongMessageForm::ScrollDown()
{
if (this->Form) {
form_driver(this->Form, REQ_END_FIELD);
this->UpdateStatusBar();
touchwin(stdscr);
wrefresh(stdscr);
}
}