File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
seleniumbase/console_scripts Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -33,16 +33,17 @@ def invalid_run_command(msg=None):
33
33
34
34
35
35
def sc_ranges ():
36
- # Get the ranges of special characters of Chinese, Japanese, and Korean .
36
+ # Get the ranges of special double-width characters .
37
37
special_char_ranges = [
38
38
{"from" : ord ("\u4e00 " ), "to" : ord ("\u9FFF " )},
39
39
{"from" : ord ("\u3040 " ), "to" : ord ("\u30ff " )},
40
40
{"from" : ord ("\uac00 " ), "to" : ord ("\ud7a3 " )},
41
+ {"from" : ord ("\uff01 " ), "to" : ord ("\uff60 " )},
41
42
]
42
43
return special_char_ranges
43
44
44
45
45
- def is_cjk (char ):
46
+ def is_char_wide (char ):
46
47
# Returns True if the special character is Chinese, Japanese, or Korean.
47
48
sc = any (
48
49
[range ["from" ] <= ord (char ) <= range ["to" ] for range in sc_ranges ()]
@@ -52,10 +53,10 @@ def is_cjk(char):
52
53
53
54
def get_width (line ):
54
55
# Return the true width of the line. Not the same as line length.
55
- # Chinese/Japanese/Korean characters take up double width visually .
56
+ # Chinese/Japanese/Korean characters take up two spaces of width .
56
57
line_length = len (line )
57
58
for char in line :
58
- if is_cjk (char ):
59
+ if is_char_wide (char ):
59
60
line_length += 1
60
61
return line_length
61
62
You can’t perform that action at this time.
0 commit comments