[ttssh2-commit] [10286] DECSCNM有効時のBCE動作がおかしい問題を修正

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2022年 9月 24日 (土) 23:19:40 JST


Revision: 10286
          https://osdn.net/projects/ttssh2/scm/svn/commits/10286
Author:   zmatsuo
Date:     2022-09-24 23:19:40 +0900 (Sat, 24 Sep 2022)
Log Message:
-----------
DECSCNM有効時のBCE動作がおかしい問題を修正

- BCE = Back Color Erase: 消去部分に背景色を適用
- DECSCNM有効時、背景色の入れ替えを行っていなかった
- r10269からおかしくなっていたので修正

Modified Paths:
--------------
    branches/4-stable/teraterm/teraterm/vtdisp.c

-------------- next part --------------
Modified: branches/4-stable/teraterm/teraterm/vtdisp.c
===================================================================
--- branches/4-stable/teraterm/teraterm/vtdisp.c	2022-09-24 14:19:29 UTC (rev 10285)
+++ branches/4-stable/teraterm/teraterm/vtdisp.c	2022-09-24 14:19:40 UTC (rev 10286)
@@ -3701,22 +3701,30 @@
   UpdateBGBrush();
 }
 
-void UpdateBGBrush() {
-  if (Background != NULL) DeleteObject(Background);
+static void UpdateBGBrush(void)
+{
+	if (Background != NULL) DeleteObject(Background);
 
-  if ((CurCharAttr.Attr2 & Attr2Back) != 0) {
-    if ((CurCharAttr.Back<16) && (CurCharAttr.Back&7)!=0)
-      Background = CreateSolidBrush(ANSIColor[CurCharAttr.Back ^ 8]);
-    else
-      Background = CreateSolidBrush(ANSIColor[CurCharAttr.Back]);
-  }
-  else {
-#ifdef ALPHABLEND_TYPE2
-    Background = CreateSolidBrush(BGVTColor[1]);
-#else
-    Background = CreateSolidBrush(ts.VTColor[1]);
-#endif  // ALPHABLEND_TYPE2
-  }
+	if ((ts.ColorFlag & CF_REVERSEVIDEO) == 0) {
+		if ((CurCharAttr.Attr2 & Attr2Back) != 0) {
+			const WORD AttrFlag = ((ts.ColorFlag & CF_BLINKCOLOR) && (CurCharAttr.Attr & AttrBlink)) ? AttrBlink : 0;
+			const int index = Get256ColorIndex(CurCharAttr.Back, ts.ColorFlag & CF_PCBOLD16, AttrFlag & AttrBlink);
+			Background = CreateSolidBrush(ANSIColor[index]);
+		}
+		else {
+			Background = CreateSolidBrush(BGVTColor[1]);
+		}
+	}
+	else {
+		if ((CurCharAttr.Attr2 & Attr2Fore) != 0) {
+			const WORD AttrFlag = ((ts.ColorFlag & CF_BOLDCOLOR) && (CurCharAttr.Attr & AttrBold)) ? AttrBold : 0;
+			const int index = Get256ColorIndex(CurCharAttr.Fore, ts.ColorFlag & CF_PCBOLD16, AttrFlag & AttrBold);
+			Background = CreateSolidBrush(ANSIColor[index]);
+		}
+		else {
+			Background = CreateSolidBrush(BGVTColor[0]);
+		}
+	}
 }
 
 void DispShowWindow(int mode)


ttssh2-commit メーリングリストの案内
Back to archive index