| 1835 |
} |
} |
| 1836 |
} |
} |
| 1837 |
|
|
| 1838 |
void CSSetAttr() // SGR |
void ParseSGRParams(PCharAttr attr, PCharAttr mask, int start) |
| 1839 |
{ |
{ |
| 1840 |
int i, j, P, r, g, b, color; |
int i, j, P, r, g, b, color; |
| 1841 |
|
TCharAttr dummy; |
| 1842 |
|
|
| 1843 |
UpdateStr(); |
if (mask == NULL) { |
| 1844 |
for (i=1 ; i<=NParam ; i++) |
mask = &dummy; |
| 1845 |
|
} |
| 1846 |
|
|
| 1847 |
|
for (i=start ; i<=NParam ; i++) |
| 1848 |
{ |
{ |
| 1849 |
P = Param[i]; |
P = Param[i]; |
| 1850 |
switch (P) { |
switch (P) { |
| 1851 |
case 0: /* Clear all */ |
case 0: /* Clear all */ |
| 1852 |
if (CharAttr.Attr2 & Attr2Protect) { |
attr->Attr = DefCharAttr.Attr; |
| 1853 |
CharAttr = DefCharAttr; |
attr->Attr2 = DefCharAttr.Attr2 | (attr->Attr2&Attr2Protect); |
| 1854 |
CharAttr.Attr2 |= Attr2Protect; |
attr->Fore = DefCharAttr.Fore; |
| 1855 |
} |
attr->Back = DefCharAttr.Back; |
| 1856 |
else { |
mask->Attr = AttrSgrMask; |
| 1857 |
CharAttr = DefCharAttr; |
mask->Attr2 = Attr2ColorMask; |
|
} |
|
|
BuffSetCurCharAttr(CharAttr); |
|
| 1858 |
break; |
break; |
| 1859 |
|
|
| 1860 |
case 1: /* Bold */ |
case 1: /* Bold */ |
| 1861 |
CharAttr.Attr |= AttrBold; |
attr->Attr |= AttrBold; |
| 1862 |
BuffSetCurCharAttr(CharAttr); |
mask->Attr |= AttrBold; |
| 1863 |
break; |
break; |
| 1864 |
|
|
| 1865 |
case 4: /* Under line */ |
case 4: /* Under line */ |
| 1866 |
CharAttr.Attr |= AttrUnder; |
attr->Attr |= AttrUnder; |
| 1867 |
BuffSetCurCharAttr(CharAttr); |
mask->Attr |= AttrUnder; |
| 1868 |
break; |
break; |
| 1869 |
|
|
| 1870 |
case 5: /* Blink */ |
case 5: /* Blink */ |
| 1871 |
CharAttr.Attr |= AttrBlink; |
attr->Attr |= AttrBlink; |
| 1872 |
BuffSetCurCharAttr(CharAttr); |
mask->Attr |= AttrBlink; |
| 1873 |
break; |
break; |
| 1874 |
|
|
| 1875 |
case 7: /* Reverse */ |
case 7: /* Reverse */ |
| 1876 |
CharAttr.Attr |= AttrReverse; |
attr->Attr |= AttrReverse; |
| 1877 |
BuffSetCurCharAttr(CharAttr); |
mask->Attr |= AttrReverse; |
| 1878 |
break; |
break; |
| 1879 |
|
|
| 1880 |
case 22: /* Bold off */ |
case 22: /* Bold off */ |
| 1881 |
CharAttr.Attr &= ~ AttrBold; |
attr->Attr &= ~ AttrBold; |
| 1882 |
BuffSetCurCharAttr(CharAttr); |
mask->Attr |= AttrBold; |
| 1883 |
break; |
break; |
| 1884 |
|
|
| 1885 |
case 24: /* Under line off */ |
case 24: /* Under line off */ |
| 1886 |
CharAttr.Attr &= ~ AttrUnder; |
attr->Attr &= ~ AttrUnder; |
| 1887 |
BuffSetCurCharAttr(CharAttr); |
mask->Attr |= AttrUnder; |
| 1888 |
break; |
break; |
| 1889 |
|
|
| 1890 |
case 25: /* Blink off */ |
case 25: /* Blink off */ |
| 1891 |
CharAttr.Attr &= ~ AttrBlink; |
attr->Attr &= ~ AttrBlink; |
| 1892 |
BuffSetCurCharAttr(CharAttr); |
mask->Attr |= AttrBlink; |
| 1893 |
break; |
break; |
| 1894 |
|
|
| 1895 |
case 27: /* Reverse off */ |
case 27: /* Reverse off */ |
| 1896 |
CharAttr.Attr &= ~ AttrReverse; |
attr->Attr &= ~ AttrReverse; |
| 1897 |
BuffSetCurCharAttr(CharAttr); |
mask->Attr |= AttrReverse; |
| 1898 |
break; |
break; |
| 1899 |
|
|
| 1900 |
case 30: |
case 30: |
| 1905 |
case 35: |
case 35: |
| 1906 |
case 36: |
case 36: |
| 1907 |
case 37: /* text color */ |
case 37: /* text color */ |
| 1908 |
CharAttr.Attr2 |= Attr2Fore; |
attr->Attr2 |= Attr2Fore; |
| 1909 |
CharAttr.Fore = P - 30; |
mask->Attr2 |= Attr2Fore; |
| 1910 |
BuffSetCurCharAttr(CharAttr); |
attr->Fore = P - 30; |
| 1911 |
break; |
break; |
| 1912 |
|
|
| 1913 |
case 38: /* text color (256color mode) */ |
case 38: /* text color (256color mode) */ |
| 1977 |
break; |
break; |
| 1978 |
} |
} |
| 1979 |
if (color >= 0 && color < 256) { |
if (color >= 0 && color < 256) { |
| 1980 |
CharAttr.Attr2 |= Attr2Fore; |
attr->Attr2 |= Attr2Fore; |
| 1981 |
CharAttr.Fore = color; |
mask->Attr2 |= Attr2Fore; |
| 1982 |
BuffSetCurCharAttr(CharAttr); |
attr->Fore = color; |
| 1983 |
} |
} |
| 1984 |
} |
} |
| 1985 |
break; |
break; |
| 1986 |
|
|
| 1987 |
case 39: /* Reset text color */ |
case 39: /* Reset text color */ |
| 1988 |
CharAttr.Attr2 &= ~ Attr2Fore; |
attr->Attr2 &= ~ Attr2Fore; |
| 1989 |
CharAttr.Fore = AttrDefaultFG; |
mask->Attr2 |= Attr2Fore; |
| 1990 |
BuffSetCurCharAttr(CharAttr); |
attr->Fore = AttrDefaultFG; |
| 1991 |
break; |
break; |
| 1992 |
|
|
| 1993 |
case 40: |
case 40: |
| 1998 |
case 45: |
case 45: |
| 1999 |
case 46: |
case 46: |
| 2000 |
case 47: /* Back color */ |
case 47: /* Back color */ |
| 2001 |
CharAttr.Attr2 |= Attr2Back; |
attr->Attr2 |= Attr2Back; |
| 2002 |
CharAttr.Back = P - 40; |
mask->Attr2 |= Attr2Back; |
| 2003 |
BuffSetCurCharAttr(CharAttr); |
attr->Back = P - 40; |
| 2004 |
break; |
break; |
| 2005 |
|
|
| 2006 |
case 48: /* Back color (256color mode) */ |
case 48: /* Back color (256color mode) */ |
| 2059 |
break; |
break; |
| 2060 |
} |
} |
| 2061 |
if (color >= 0 && color < 256) { |
if (color >= 0 && color < 256) { |
| 2062 |
CharAttr.Attr2 |= Attr2Back; |
attr->Attr2 |= Attr2Back; |
| 2063 |
CharAttr.Back = color; |
mask->Attr2 |= Attr2Back; |
| 2064 |
BuffSetCurCharAttr(CharAttr); |
attr->Back = color; |
| 2065 |
} |
} |
| 2066 |
} |
} |
| 2067 |
break; |
break; |
| 2068 |
|
|
| 2069 |
case 49: /* Reset back color */ |
case 49: /* Reset back color */ |
| 2070 |
CharAttr.Attr2 &= ~ Attr2Back; |
attr->Attr2 &= ~ Attr2Back; |
| 2071 |
CharAttr.Back = AttrDefaultBG; |
mask->Attr2 |= Attr2Back; |
| 2072 |
BuffSetCurCharAttr(CharAttr); |
attr->Back = AttrDefaultBG; |
| 2073 |
break; |
break; |
| 2074 |
|
|
| 2075 |
case 90: |
case 90: |
| 2081 |
case 96: |
case 96: |
| 2082 |
case 97: /* aixterm style text color */ |
case 97: /* aixterm style text color */ |
| 2083 |
if (ts.ColorFlag & CF_AIXTERM16) { |
if (ts.ColorFlag & CF_AIXTERM16) { |
| 2084 |
CharAttr.Attr2 |= Attr2Fore; |
attr->Attr2 |= Attr2Fore; |
| 2085 |
CharAttr.Fore = P - 90 + 8; |
mask->Attr2 |= Attr2Fore; |
| 2086 |
BuffSetCurCharAttr(CharAttr); |
attr->Fore = P - 90 + 8; |
| 2087 |
} |
} |
| 2088 |
break; |
break; |
| 2089 |
|
|
| 2090 |
case 100: |
case 100: |
| 2091 |
if (! (ts.ColorFlag & CF_AIXTERM16)) { |
if (! (ts.ColorFlag & CF_AIXTERM16)) { |
| 2092 |
/* Reset text and back color */ |
/* Reset text and back color */ |
| 2093 |
CharAttr.Attr2 &= ~ (Attr2Fore | Attr2Back); |
attr->Attr2 &= ~ (Attr2Fore | Attr2Back); |
| 2094 |
CharAttr.Fore = AttrDefaultFG; |
mask->Attr2 |= Attr2ColorMask; |
| 2095 |
CharAttr.Back = AttrDefaultBG; |
attr->Fore = AttrDefaultFG; |
| 2096 |
BuffSetCurCharAttr(CharAttr); |
attr->Back = AttrDefaultBG; |
| 2097 |
break; |
break; |
| 2098 |
} |
} |
| 2099 |
/* fall through to aixterm style back color */ |
/* fall through to aixterm style back color */ |
| 2106 |
case 106: |
case 106: |
| 2107 |
case 107: /* aixterm style back color */ |
case 107: /* aixterm style back color */ |
| 2108 |
if (ts.ColorFlag & CF_AIXTERM16) { |
if (ts.ColorFlag & CF_AIXTERM16) { |
| 2109 |
CharAttr.Attr2 |= Attr2Back; |
attr->Attr2 |= Attr2Back; |
| 2110 |
CharAttr.Back = P - 100 + 8; |
mask->Attr2 |= Attr2Back; |
| 2111 |
BuffSetCurCharAttr(CharAttr); |
attr->Back = P - 100 + 8; |
| 2112 |
} |
} |
| 2113 |
break; |
break; |
| 2114 |
} |
} |
| 2115 |
} |
} |
| 2116 |
} |
} |
| 2117 |
|
|
| 2118 |
|
void CSSetAttr() // SGR |
| 2119 |
|
{ |
| 2120 |
|
UpdateStr(); |
| 2121 |
|
ParseSGRParams(&CharAttr, NULL, 1); |
| 2122 |
|
BuffSetCurCharAttr(CharAttr); |
| 2123 |
|
} |
| 2124 |
|
|
| 2125 |
void CSSetScrollRegion() |
void CSSetScrollRegion() |
| 2126 |
{ |
{ |
| 2127 |
if ((StatusLine>0) && |
if ((StatusLine>0) && |
| 2820 |
|
|
| 2821 |
void CSDol(BYTE b) |
void CSDol(BYTE b) |
| 2822 |
{ |
{ |
| 2823 |
|
TCharAttr attr, mask; |
| 2824 |
|
attr = DefCharAttr; |
| 2825 |
|
mask = DefCharAttr; |
| 2826 |
|
|
| 2827 |
switch (b) { |
switch (b) { |
| 2828 |
|
case 'r': // DECCARA |
| 2829 |
|
case 't': // DECRARA |
| 2830 |
|
if (Param[1] < 1 || NParam < 1) Param[1] = 1; |
| 2831 |
|
if (Param[2] < 1 || NParam < 2) Param[2] = 1; |
| 2832 |
|
if (Param[3] < 1 || NParam < 3) Param[3] = NumOfLines-StatusLine; |
| 2833 |
|
if (Param[4] < 1 || NParam < 4) Param[4] = NumOfColumns; |
| 2834 |
|
if (Param[1] <= Param[3] && Param[2] <= Param[4]) { |
| 2835 |
|
if (RelativeOrgMode) { |
| 2836 |
|
Param[1] += CursorTop; |
| 2837 |
|
if (Param[1] > CursorBottom) { |
| 2838 |
|
Param[1] = CursorBottom + 1; |
| 2839 |
|
} |
| 2840 |
|
Param[3] += CursorTop; |
| 2841 |
|
if (Param[3] > CursorBottom) { |
| 2842 |
|
Param[3] = CursorBottom + 1; |
| 2843 |
|
} |
| 2844 |
|
} |
| 2845 |
|
} |
| 2846 |
|
ParseSGRParams(&attr, &mask, 5); |
| 2847 |
|
if (b == 'r') { // DECCARA |
| 2848 |
|
attr.Attr &= AttrSgrMask; |
| 2849 |
|
mask.Attr &= AttrSgrMask; |
| 2850 |
|
attr.Attr2 &= Attr2ColorMask; |
| 2851 |
|
mask.Attr2 &= Attr2ColorMask; |
| 2852 |
|
BuffChangeAttrBox(Param[2]-1, Param[1]-1, Param[4]-1, Param[3]-1, &attr, &mask); |
| 2853 |
|
} |
| 2854 |
|
else { // DECRARA |
| 2855 |
|
attr.Attr &= AttrSgrMask; |
| 2856 |
|
BuffChangeAttrBox(Param[2]-1, Param[1]-1, Param[4]-1, Param[3]-1, &attr, NULL); |
| 2857 |
|
} |
| 2858 |
|
break; |
| 2859 |
case 'v': // DECCRA |
case 'v': // DECCRA |
| 2860 |
if (Param[1] < 1 || NParam < 1) Param[1] = 1; |
if (Param[1] < 1 || NParam < 1) Param[1] = 1; |
| 2861 |
if (Param[2] < 1 || NParam < 2) Param[2] = 1; |
if (Param[2] < 1 || NParam < 2) Param[2] = 1; |