4 ms·
Rather than turn off all attributes with "tput sgr0", instead I Save Cursor with "tput sc" at the beginning to save attributes, and Restore Cursor with "tput rc
by mmphosis 5y ago
Rather than turn off all attributes with "tput sgr0", instead I Save Cursor with "tput sc" at the beginning to save attributes, and Restore Cursor with "tput rc" at the end to restore attributes.
Save and Restore cursor doesn't always work because I don't necessarily need the vertical position restored, for example:
ls_color () {
tput sc;
/bin/ls --color=auto "$@";
push_cursor_position;
tput rc;
pop_cursor_position
}