mirror of
https://github.com/termux/termux-app
synced 2024-06-24 18:17:07 +00: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:
parent
58f9f1be71
commit
2e9383720c
|
@ -1307,6 +1307,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;
|
||||
|
@ -1318,6 +1320,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;
|
||||
|
@ -2263,8 +2267,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;
|
||||
|
@ -2318,7 +2322,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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user