Mercurial > jwe > octave
changeset 28124:74bc925ae235 stable
Swap colors indices used for win terminal to match native indices (bug #57658).
* libgui/qterminal/libqterminal/win32/QTerminalColors.cpp:
Swap colors for indices 0, 7, 15.
* libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp:
Use color 0 for background, color 7 for foreground. Explicity fill background.
author | John Donoghue <john.donoghue@ieee.org> |
---|---|
date | Mon, 17 Feb 2020 21:04:52 -0500 |
parents | f2789cae04f3 |
children | a578890b4942 |
files | libgui/qterminal/libqterminal/win32/QTerminalColors.cpp libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp |
diffstat | 2 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/qterminal/libqterminal/win32/QTerminalColors.cpp Fri Feb 21 11:31:45 2020 +0100 +++ b/libgui/qterminal/libqterminal/win32/QTerminalColors.cpp Mon Feb 17 21:04:52 2020 -0500 @@ -30,14 +30,14 @@ QConsoleColors::QConsoleColors (void) : QMap<int, QColor> () { - (*this)[0] = Qt::black; + (*this)[0] = Qt::white; (*this)[1] = Qt::darkBlue; (*this)[2] = Qt::darkGreen; (*this)[3] = Qt::darkCyan; (*this)[4] = Qt::darkRed; (*this)[5] = Qt::darkMagenta; (*this)[6] = Qt::darkYellow; - (*this)[7] = Qt::lightGray; + (*this)[7] = Qt::black; (*this)[8] = Qt::darkGray; (*this)[9] = Qt::blue; (*this)[10] = Qt::green; @@ -45,5 +45,5 @@ (*this)[12] = Qt::red; (*this)[13] = Qt::magenta; (*this)[14] = Qt::yellow; - (*this)[15] = Qt::white; + (*this)[15] = Qt::lightGray; }
--- a/libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp Fri Feb 21 11:31:45 2020 +0100 +++ b/libgui/qterminal/libqterminal/win32/QWinTerminalImpl.cpp Mon Feb 17 21:04:52 2020 -0500 @@ -390,13 +390,13 @@ SetConsoleOutputCP (65001); } - // Choose 15 (0xF) as index into the Windows console color map for the - // background and 0 (0x0) as the index for the foreground. This + // Choose 0 (0x0) as index into the Windows console color map for the + // background and 7 (0x7) as the index for the foreground. This // selection corresponds to the indices used in the foregroundColor, // setForegroundColor, backgroundColor, and SetBackgroundColor // functions. - SetConsoleTextAttribute (m_stdOut, 0xF0); + SetConsoleTextAttribute (m_stdOut, 0x07); // Defaults. setBackgroundColor (Qt::white); @@ -408,8 +408,6 @@ QPalette palette (backgroundColor ()); m_consoleView->setPalette (palette); - m_consoleView->setAutoFillBackground (true); - m_consoleView->setFont (m_font); parent->setFocusPolicy (Qt::StrongFocus); parent->winId (); @@ -581,12 +579,12 @@ QColor QConsolePrivate::backgroundColor (void) const { - return m_colors[15]; + return m_colors[0]; } QColor QConsolePrivate::foregroundColor (void) const { - return m_colors[0]; + return m_colors[7]; } QColor QConsolePrivate::selectionColor (void) const @@ -601,15 +599,16 @@ void QConsolePrivate::setBackgroundColor (const QColor& color) { - m_colors[15] = color; + m_colors[0] = color; QPalette palette (color); + palette.setColor(QPalette::Base, color); m_consoleView->setPalette (palette); } void QConsolePrivate::setForegroundColor (const QColor& color) { - m_colors[0] = color; + m_colors[7] = color; } void QConsolePrivate::setSelectionColor (const QColor& color) @@ -1557,6 +1556,7 @@ int ch = d->m_charSize.height (); QRect updateRect = event->rect (); + p.fillRect(updateRect, QBrush(d->backgroundColor())); int cx1 = updateRect.left () / cw; int cy1 = updateRect.top () / ch;