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.
When the number of parameters in a CSI control code exceeds the size of
the mArgs array, the code may attempt to read past the end of the array,
resulting in a force close of the app.
Stop the index from moving past the last element of the mArgs array.