Fixes #2317. Drivers do not normalize accented letters.

This commit is contained in:
BDisp
2023-02-05 00:25:14 +00:00
parent 3d75be4ea6
commit 788eed4a4d
5 changed files with 166 additions and 90 deletions

View File

@@ -62,40 +62,59 @@ namespace Terminal.Gui {
Curses.move (crow, ccol);
needMove = false;
}
if (runeWidth < 2 && ccol > 0
&& Rune.ColumnWidth ((char)contents [crow, ccol - 1, 0]) > 1) {
if (runeWidth == 0 && ccol > 0) {
var r = contents [crow, ccol - 1, 0];
var s = new string (new char [] { (char)r, (char)rune });
string sn;
if (!s.IsNormalized ()) {
sn = s.Normalize ();
} else {
sn = s;
}
var c = sn [0];
Curses.mvaddch (crow, ccol - 1, (int)(uint)c);
contents [crow, ccol - 1, 0] = c;
contents [crow, ccol - 1, 1] = currentAttribute;
contents [crow, ccol - 1, 2] = 1;
var curAtttib = currentAttribute;
Curses.attrset (contents [crow, ccol - 1, 1]);
Curses.mvaddch (crow, ccol - 1, (int)(uint)' ');
contents [crow, ccol - 1, 0] = (int)(uint)' ';
Curses.move (crow, ccol);
Curses.attrset (curAtttib);
} else if (runeWidth < 2 && ccol <= Clip.Right - 1
&& Rune.ColumnWidth ((char)contents [crow, ccol, 0]) > 1) {
var curAtttib = currentAttribute;
Curses.attrset (contents [crow, ccol + 1, 1]);
Curses.mvaddch (crow, ccol + 1, (int)(uint)' ');
contents [crow, ccol + 1, 0] = (int)(uint)' ';
Curses.move (crow, ccol);
Curses.attrset (curAtttib);
}
if (runeWidth > 1 && ccol == Clip.Right - 1) {
Curses.addch ((int)(uint)' ');
contents [crow, ccol, 0] = (int)(uint)' ';
} else {
Curses.addch ((int)(uint)rune);
contents [crow, ccol, 0] = (int)(uint)rune;
if (runeWidth < 2 && ccol > 0
&& Rune.ColumnWidth ((char)contents [crow, ccol - 1, 0]) > 1) {
var curAtttib = currentAttribute;
Curses.attrset (contents [crow, ccol - 1, 1]);
Curses.mvaddch (crow, ccol - 1, (int)(uint)' ');
contents [crow, ccol - 1, 0] = (int)(uint)' ';
Curses.move (crow, ccol);
Curses.attrset (curAtttib);
} else if (runeWidth < 2 && ccol <= Clip.Right - 1
&& Rune.ColumnWidth ((char)contents [crow, ccol, 0]) > 1) {
var curAtttib = currentAttribute;
Curses.attrset (contents [crow, ccol + 1, 1]);
Curses.mvaddch (crow, ccol + 1, (int)(uint)' ');
contents [crow, ccol + 1, 0] = (int)(uint)' ';
Curses.move (crow, ccol);
Curses.attrset (curAtttib);
}
if (runeWidth > 1 && ccol == Clip.Right - 1) {
Curses.addch ((int)(uint)' ');
contents [crow, ccol, 0] = (int)(uint)' ';
} else {
Curses.addch ((int)(uint)rune);
contents [crow, ccol, 0] = (int)(uint)rune;
}
contents [crow, ccol, 1] = currentAttribute;
contents [crow, ccol, 2] = 1;
}
contents [crow, ccol, 1] = currentAttribute;
contents [crow, ccol, 2] = 1;
} else
needMove = true;
ccol++;
if (runeWidth < 0 || runeWidth > 0) {
ccol++;
}
if (runeWidth > 1) {
if (validClip && ccol < Clip.Right) {
contents [crow, ccol, 1] = currentAttribute;