mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-07 19:14:04 +08:00
Make cursor save/restore affect color attributes
SGR attributes are stored in three variables: mEffect, mForeColor, and mBackColor. Saving/restoring the cursor only preserves mEffect. Change the cursor save/restore methods to additionally preserve mForeColor and mBackColor. This affects both 'explit' saving/restoring the cursor and switching to/from the alternate screen buffer.
This commit is contained in:
@@ -1307,6 +1307,8 @@ public final class TerminalEmulator {
|
|||||||
state.mSavedCursorRow = mCursorRow;
|
state.mSavedCursorRow = mCursorRow;
|
||||||
state.mSavedCursorCol = mCursorCol;
|
state.mSavedCursorCol = mCursorCol;
|
||||||
state.mSavedEffect = mEffect;
|
state.mSavedEffect = mEffect;
|
||||||
|
state.mSavedForeColor = mForeColor;
|
||||||
|
state.mSavedBackColor = mBackColor;
|
||||||
state.mSavedDecFlags = mCurrentDecSetFlags;
|
state.mSavedDecFlags = mCurrentDecSetFlags;
|
||||||
state.mUseLineDrawingG0 = mUseLineDrawingG0;
|
state.mUseLineDrawingG0 = mUseLineDrawingG0;
|
||||||
state.mUseLineDrawingG1 = mUseLineDrawingG1;
|
state.mUseLineDrawingG1 = mUseLineDrawingG1;
|
||||||
@@ -1318,6 +1320,8 @@ public final class TerminalEmulator {
|
|||||||
SavedScreenState state = (mScreen == mMainBuffer) ? mSavedStateMain : mSavedStateAlt;
|
SavedScreenState state = (mScreen == mMainBuffer) ? mSavedStateMain : mSavedStateAlt;
|
||||||
setCursorRowCol(state.mSavedCursorRow, state.mSavedCursorCol);
|
setCursorRowCol(state.mSavedCursorRow, state.mSavedCursorCol);
|
||||||
mEffect = state.mSavedEffect;
|
mEffect = state.mSavedEffect;
|
||||||
|
mForeColor = state.mSavedForeColor;
|
||||||
|
mBackColor = state.mSavedBackColor;
|
||||||
int mask = (DECSET_BIT_AUTOWRAP | DECSET_BIT_ORIGIN_MODE);
|
int mask = (DECSET_BIT_AUTOWRAP | DECSET_BIT_ORIGIN_MODE);
|
||||||
mCurrentDecSetFlags = (mCurrentDecSetFlags & ~mask) | (state.mSavedDecFlags & mask);
|
mCurrentDecSetFlags = (mCurrentDecSetFlags & ~mask) | (state.mSavedDecFlags & mask);
|
||||||
mUseLineDrawingG0 = state.mUseLineDrawingG0;
|
mUseLineDrawingG0 = state.mUseLineDrawingG0;
|
||||||
@@ -2263,8 +2267,8 @@ public final class TerminalEmulator {
|
|||||||
mBottomMargin = mRows;
|
mBottomMargin = mRows;
|
||||||
mRightMargin = mColumns;
|
mRightMargin = mColumns;
|
||||||
mAboutToAutoWrap = false;
|
mAboutToAutoWrap = false;
|
||||||
mForeColor = TextStyle.COLOR_INDEX_FOREGROUND;
|
mForeColor = mSavedStateMain.mSavedForeColor = mSavedStateAlt.mSavedForeColor = TextStyle.COLOR_INDEX_FOREGROUND;
|
||||||
mBackColor = TextStyle.COLOR_INDEX_BACKGROUND;
|
mBackColor = mSavedStateMain.mSavedBackColor = mSavedStateAlt.mSavedBackColor = TextStyle.COLOR_INDEX_BACKGROUND;
|
||||||
setDefaultTabStops();
|
setDefaultTabStops();
|
||||||
|
|
||||||
mUseLineDrawingG0 = mUseLineDrawingG1 = false;
|
mUseLineDrawingG0 = mUseLineDrawingG1 = false;
|
||||||
@@ -2318,7 +2322,7 @@ public final class TerminalEmulator {
|
|||||||
static final class SavedScreenState {
|
static final class SavedScreenState {
|
||||||
/** Saved state of the cursor position, Used to implement the save/restore cursor position escape sequences. */
|
/** Saved state of the cursor position, Used to implement the save/restore cursor position escape sequences. */
|
||||||
int mSavedCursorRow, mSavedCursorCol;
|
int mSavedCursorRow, mSavedCursorCol;
|
||||||
int mSavedEffect;
|
int mSavedEffect, mSavedForeColor, mSavedBackColor;
|
||||||
int mSavedDecFlags;
|
int mSavedDecFlags;
|
||||||
boolean mUseLineDrawingG0, mUseLineDrawingG1, mUseLineDrawingUsesG0 = true;
|
boolean mUseLineDrawingG0, mUseLineDrawingG1, mUseLineDrawingUsesG0 = true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user