diff --git a/gen/wcwidth.py b/gen/wcwidth.py index 225f9b68d..00f36ff34 100755 --- a/gen/wcwidth.py +++ b/gen/wcwidth.py @@ -679,6 +679,8 @@ def gen_multistage_table( c('};') +width_shift = 4 + class CharProps(NamedTuple): width: int # 3 bits @@ -691,7 +693,7 @@ class CharProps(NamedTuple): @property def as_c(self) -> str: return ('{' - f' .shifted_width={self.width + 4}, .grapheme_break=GBP_{self.grapheme_break},' + f' .shifted_width={self.width + width_shift}, .grapheme_break=GBP_{self.grapheme_break},' f' .indic_conjunct_break=ICB_{self.indic_conjunct_break},' f' .is_invalid={int(self.is_invalid)}, .is_extended_pictographic={int(self.is_extended_pictographic)},' f' .is_non_rendered={int(self.is_non_rendered)},' @@ -754,6 +756,7 @@ def gen_char_props() -> None: generate_enum(c, gp, 'GraphemeBreakProperty', 'AtStart', 'None', *grapheme_segmentation_maps, prefix='GBP_') generate_enum(c, gp, 'IndicConjunctBreak', 'None', *incb_map, prefix='ICB_') gen_multistage_table(c, gp, t1, t2, shift, mask) + gofmt(gof.name) def main(args: list[str]=sys.argv) -> None: diff --git a/tools/wcswidth/char-props-data.go b/tools/wcswidth/char-props-data.go index 483cb6141..9c9bced33 100644 --- a/tools/wcswidth/char-props-data.go +++ b/tools/wcswidth/char-props-data.go @@ -1,32 +1,30 @@ package wcswidth - type GraphemeBreakProperty uint8 const ( -GBP_AtStart GraphemeBreakProperty = iota -GBP_None -GBP_Prepend -GBP_CR -GBP_LF -GBP_Control -GBP_Extend -GBP_Regional_Indicator -GBP_SpacingMark -GBP_L -GBP_V -GBP_T -GBP_LV -GBP_LVT -GBP_ZWJ + GBP_AtStart GraphemeBreakProperty = iota + GBP_None + GBP_Prepend + GBP_CR + GBP_LF + GBP_Control + GBP_Extend + GBP_Regional_Indicator + GBP_SpacingMark + GBP_L + GBP_V + GBP_T + GBP_LV + GBP_LVT + GBP_ZWJ ) type IndicConjunctBreak uint8 const ( -ICB_None IndicConjunctBreak = iota -ICB_Linker -ICB_Consonant -ICB_Extend + ICB_None IndicConjunctBreak = iota + ICB_Linker + ICB_Consonant + ICB_Extend ) -