开发者

How do you save the cursor attributes without saving position with escape sequence?

开发者 https://www.devze.com 2022-12-20 21:27 出处:网络
printf \'\\e[s\' will save the attributes and position of the cursor, so that the script can reset them using printf \'\\e[u\'.But I only want to save the attributes.In other words, I want to change t

printf '\e[s' will save the attributes and position of the cursor, so that the script can reset them using printf '\e[u'. But I only want to save the attributes. In other words, I want to change the color of text, print some text, and then restor开发者_StackOverflowe the color settings at the end of the script. If I use the [s and [u sequences, I will be resetting the position, which I do not want.

What's the easiest way to restore the color attributes to the cursor without restoring the position?


   ESC 7 (DECSC)   save state
   ESC 8 (DECRC)   restore most recently saved state

Didn't try it out though ...

0

精彩评论

暂无评论...
验证码 换一张
取 消