Termux will now properly send \r to the terminal instead of \n when pasting
multiline strings.
This fixes cat not repeating back lines and nano accidentally justifying
text (because \n maps to ^J), as well as other potential issues.
This matches the behavior of other terminals, such as iTerm2 which explicitly
does it here:
https://github.com/gnachman/iTerm2/blob/f8a5930/sources/iTermPasteHelper.m#L113
Signed-off-by: easyaspi314 (Devin) <easyaspi314@users.noreply.github.com>
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.