Cleanup - fix various tests.

This commit is contained in:
Per Bothner
2023-05-17 18:37:27 -07:00
parent 2f7fe1189c
commit 67e968926c
12 changed files with 136 additions and 54 deletions
@@ -219,14 +219,12 @@ export class UnicodeV11 implements IUnicodeVersionProvider {
return 1;
}
charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {
public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {
let width = this.wcwidth(codepoint);
let shouldJoin = width === 0;
let shouldJoin = width === 0 && preceding !== 0;
if (shouldJoin) {
let oldWidth = preceding === 0 ? 0
: UnicodeService.extractWidth(preceding);
const oldWidth = UnicodeService.extractWidth(preceding);
if (oldWidth === 0) {
width = 1;
shouldJoin = false;
} else if (oldWidth > width) {
width = oldWidth;