termux-play-store / termux-apps

Source for the Termux build on Google Play.
https://play.google.com/store/apps/details?id=com.termux
Other
35 stars 1 forks source link

Fixed: Improve handling of empty ';' SGR sequences #20

Closed fornwall closed 3 days ago

fornwall commented 5 days ago

Currently the Termux terminal emulator prints HI in red with:

printf "\e[31;m HI \e[0m"

This is not how other terminals (tested on xterm, gnome-terminal, alacritty and the mac built in terminal) handle it, since they parse \e[31;m as \e[31;0m, where the 0 resets the colors.

This change aligns with other terminals, as well as improves performance by avoiding allocating a new int[] array for each byte processed by parseArg(), and most importantly simplifies things by removing the mIsCSIStart and mLastCSIArg state, preparing for soon supporting : separated sub parameters such as used in https://sw.kovidgoyal.net/kitty/underlines/