File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -101,9 +101,19 @@ func NewCondition() *Condition {
101101// See http://www.unicode.org/reports/tr11/
102102func (c * Condition ) RuneWidth (r rune ) int {
103103 switch {
104- case r < 0 || r > 0x10FFFF || inTables ( r , nonprint , combining , notassigned ) :
104+ case r < 0 || r > 0x10FFFF :
105105 return 0
106- case (c .EastAsianWidth && IsAmbiguousWidth (r )) || inTables (r , doublewidth ):
106+ case c .EastAsianWidth && IsAmbiguousWidth (r ):
107+ return 2
108+ // Fast path
109+ case r < 0x0300 : // neither combining, non-assigned or double-width
110+ if r <= 0x001F || (0x007F <= r && r <= 0x009F ) || r == 0x00AD { // non-printable
111+ return 0
112+ }
113+ return 1
114+ case inTables (r , nonprint , combining , notassigned ):
115+ return 0
116+ case inTables (r , doublewidth ):
107117 return 2
108118 default :
109119 return 1
You can’t perform that action at this time.
0 commit comments