File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change 1
1
# ABSTRACT: Input widgets for duospace (Unicode terminal) text input
2
2
3
3
use Text::MiscUtils::Layout;
4
+ use Terminal::Capabilities;
5
+
4
6
use Terminal::LineEditor::EditableBuffer;
5
7
6
8
@@ -46,18 +48,31 @@ class Terminal::LineEditor::ScrollingSingleLineInput
46
48
does Terminal::LineEditor::DuospaceLayoutCache {
47
49
has UInt : D $ . display-width is required ;
48
50
49
- has Str : D $ . left-scroll-mark = ' ◀' ;
50
- has Str : D $ . right-scroll-mark = ' ▶' ;
51
+ # For backwards compatibility, default to symbol-set Uni1
52
+ has Terminal::Capabilities: D $ . caps .= new (symbol-set => symbol-set(' Uni1' ));
53
+
54
+ has Str $ . left-scroll-mark ;
55
+ has Str $ . right-scroll-mark ;
51
56
has Str : D $ . left-no-scroll-mark = ' ' ;
52
57
has Str : D $ . right-no-scroll-mark = ' ' ;
53
58
54
59
has Str $ . mask ;
55
60
has $ . scroll-cursor ;
56
61
57
62
58
- # Initialize scroll-cursor in TWEAK so buffer is ready
59
63
submethod TWEAK () {
64
+ # Initialize scroll-cursor so buffer is ready
60
65
$ ! scroll-cursor = self . buffer. add-cursor(:! auto-edit-move);
66
+
67
+ # Default scroll marks to match symbol set
68
+ my constant % marks = ASCII => « < > »,
69
+ Latin1 => < « » >,
70
+ WGL4 => < ◄ ► >,
71
+ Uni1 => < ◀ ▶ >,
72
+ Uni7 => < ⯇ ⯈ >;
73
+ my $ marks = $ ! caps . best-symbol-choice(% marks );
74
+ $ ! left-scroll-mark //= $ marks [0 ];
75
+ $ ! right-scroll-mark // = $ marks [1 ];
61
76
}
62
77
63
78
You can’t perform that action at this time.
0 commit comments