File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class Core
36
36
attr_accessor :config
37
37
attr_accessor :key_stroke
38
38
attr_accessor :line_editor
39
- attr_accessor :ambiguous_width
39
+ attr_writer :ambiguous_width
40
40
attr_accessor :last_incremental_search
41
41
attr_reader :output
42
42
@@ -356,9 +356,14 @@ def readline(prompt = '', add_hist = false)
356
356
end
357
357
end
358
358
359
+ def ambiguous_width
360
+ may_req_ambiguous_char_width unless defined? @ambiguous_width
361
+ @ambiguous_width
362
+ end
363
+
359
364
private def may_req_ambiguous_char_width
360
365
@ambiguous_width = 2 if Reline ::IOGate == Reline ::GeneralIO or STDOUT . is_a? ( File )
361
- return if ambiguous_width
366
+ return if @ ambiguous_width
362
367
Reline ::IOGate . move_cursor_column ( 0 )
363
368
begin
364
369
output . write "\u{25bd} "
Original file line number Diff line number Diff line change @@ -9,4 +9,8 @@ def setup
9
9
def test_get_mbchar_width
10
10
assert_equal Reline . ambiguous_width , Reline ::Unicode . get_mbchar_width ( 'é' )
11
11
end
12
+
13
+ def test_ambiguous_width
14
+ assert_equal 2 , Reline ::Unicode . calculate_width ( '√' , true )
15
+ end
12
16
end
You can’t perform that action at this time.
0 commit comments