Merge pull request #330 from whydoubt/cursor_preserve_color

Make cursor save/restore affect color attributes
This commit is contained in:
Fredrik Fornwall
2017-06-05 22:35:39 +02:00
committed by GitHub
2 changed files with 47 additions and 3 deletions

View File

@@ -1310,6 +1310,8 @@ public final class TerminalEmulator {
state.mSavedCursorRow = mCursorRow;
state.mSavedCursorCol = mCursorCol;
state.mSavedEffect = mEffect;
state.mSavedForeColor = mForeColor;
state.mSavedBackColor = mBackColor;
state.mSavedDecFlags = mCurrentDecSetFlags;
state.mUseLineDrawingG0 = mUseLineDrawingG0;
state.mUseLineDrawingG1 = mUseLineDrawingG1;
@@ -1321,6 +1323,8 @@ public final class TerminalEmulator {
SavedScreenState state = (mScreen == mMainBuffer) ? mSavedStateMain : mSavedStateAlt;
setCursorRowCol(state.mSavedCursorRow, state.mSavedCursorCol);
mEffect = state.mSavedEffect;
mForeColor = state.mSavedForeColor;
mBackColor = state.mSavedBackColor;
int mask = (DECSET_BIT_AUTOWRAP | DECSET_BIT_ORIGIN_MODE);
mCurrentDecSetFlags = (mCurrentDecSetFlags & ~mask) | (state.mSavedDecFlags & mask);
mUseLineDrawingG0 = state.mUseLineDrawingG0;
@@ -2268,8 +2272,8 @@ public final class TerminalEmulator {
mBottomMargin = mRows;
mRightMargin = mColumns;
mAboutToAutoWrap = false;
mForeColor = TextStyle.COLOR_INDEX_FOREGROUND;
mBackColor = TextStyle.COLOR_INDEX_BACKGROUND;
mForeColor = mSavedStateMain.mSavedForeColor = mSavedStateAlt.mSavedForeColor = TextStyle.COLOR_INDEX_FOREGROUND;
mBackColor = mSavedStateMain.mSavedBackColor = mSavedStateAlt.mSavedBackColor = TextStyle.COLOR_INDEX_BACKGROUND;
setDefaultTabStops();
mUseLineDrawingG0 = mUseLineDrawingG1 = false;
@@ -2323,7 +2327,7 @@ public final class TerminalEmulator {
static final class SavedScreenState {
/** Saved state of the cursor position, Used to implement the save/restore cursor position escape sequences. */
int mSavedCursorRow, mSavedCursorCol;
int mSavedEffect;
int mSavedEffect, mSavedForeColor, mSavedBackColor;
int mSavedDecFlags;
boolean mUseLineDrawingG0, mUseLineDrawingG1, mUseLineDrawingUsesG0 = true;
}