Made sure that the last text line is always visible in OS X startup window

These case are handled specifically:
* When waiting for clients or host to join
* When showing a fatal error
This commit is contained in:
alexey.lysiuk 2016-02-27 18:20:22 +02:00 committed by Christoph Oelckers
parent 067b421f39
commit 243f59d96d
2 changed files with 14 additions and 0 deletions

View file

@ -89,6 +89,8 @@ private:
void ExpandTextView(float height);
void AddText(const PalEntry& color, const char* message);
void ScrollTextToBottom();
};
#endif // COCOA_ST_CONSOLE_INCLUDED

View file

@ -188,6 +188,8 @@ void FConsoleWindow::ShowFatalError(const char* const message)
AddText(PalEntry(255, 255, 170), message);
AddText("\n");
ScrollTextToBottom();
[NSApp runModalForWindow:m_window];
}
@ -338,6 +340,14 @@ void FConsoleWindow::AddText(const PalEntry& color, const char* const message)
}
void FConsoleWindow::ScrollTextToBottom()
{
[m_textView scrollRangeToVisible:NSMakeRange(m_characterCount, 0)];
[[NSRunLoop currentRunLoop] limitDateForMode:NSDefaultRunLoopMode];
}
void FConsoleWindow::SetTitleText()
{
static const CGFloat TITLE_TEXT_HEIGHT = 32.0f;
@ -485,6 +495,8 @@ void FConsoleWindow::NetInit(const char* const message, const int playerCount)
[m_window setFrame:windowRect display:YES];
[[m_window contentView] addSubview:m_netView];
ScrollTextToBottom();
}
[m_netMessageText setStringValue:[NSString stringWithUTF8String:message]];