Skip to content

Commit 1d59db8

Browse files
fix #287: Incorrect marker width calculation of Unicode symbols can cause markers to not be displayed
1 parent 8e6be37 commit 1d59db8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

vit/formatter/markers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import unicodedata
12
from vit.formatter import Marker
23

34
class Markers(Marker):
@@ -35,7 +36,7 @@ def color_required(self, color):
3536
def add_label(self, color, label, width, text_markup):
3637
if self.color_required(color) or not label:
3738
return width, text_markup
38-
width += len(label)
39+
width += len(label) + len([c for c in label if unicodedata.east_asian_width(c) == 'W'])
3940
text_markup += [(color, label)]
4041
return width, text_markup
4142

0 commit comments

Comments
 (0)