瀏覽代碼

fix output of non-BMP Unicode characters in NetDriver

Chris Pacejo 2 年之前
父節點
當前提交
cb7c1be8bc
共有 2 個文件被更改,包括 8 次插入2 次删除
  1. 7 1
      Terminal.Gui/ConsoleDrivers/NetDriver.cs
  2. 1 1
      UICatalog/Scenarios/Unicode.cs

+ 7 - 1
Terminal.Gui/ConsoleDrivers/NetDriver.cs

@@ -1483,7 +1483,13 @@ namespace Terminal.Gui {
 							output.Append (WriteAttributes (attr));
 						}
 						outputWidth++;
-						output.Append ((char)contents [row, col, 0]);
+						var rune = contents [row, col, 0];
+						char [] spair;
+						if (Rune.DecodeSurrogatePair((uint) rune, out spair)) {
+							output.Append (spair);
+						} else {
+							output.Append ((char)rune);
+						}
 						contents [row, col, 2] = 0;
 					}
 				}

+ 1 - 1
UICatalog/Scenarios/Unicode.cs

@@ -97,7 +97,7 @@ namespace UICatalog.Scenarios {
 
 			label = new Label ("RadioGroup:") { X = Pos.X (label), Y = Pos.Bottom (listView) + 1 };
 			Win.Add (label);
-			var radioGroup = new RadioGroup (new ustring [] { "item #1", gitString, "Со_хранить" }, selected: 0) {
+			var radioGroup = new RadioGroup (new ustring [] { "item #1", gitString, "Со_хранить", "𝔽𝕆𝕆𝔹𝔸ℝ" }, selected: 0) {
 				X = 20,
 				Y = Pos.Y (label),
 				Width = Dim.Percent (60),