37
37
38
38
show (io:: IO , x:: Prompt ) = show (io, string (" Prompt(\" " , prompt_string (x. prompt), " \" ,...)" ))
39
39
40
- " Maximum number of entries in the kill ring queue.
41
- Beyond this number, oldest entries are discarded first."
42
- const KILL_RING_MAX = Ref (100 )
43
40
44
41
mutable struct MIState
45
42
interface:: ModalInterface
@@ -87,7 +84,7 @@ options(s::PromptState) =
87
84
# in the REPL module
88
85
s. p. repl. options
89
86
else
90
- Base. REPL. Options (confirm_exit = false )
87
+ Base. REPL. GlobalOptions
91
88
end
92
89
93
90
function setmark (s:: MIState , guess_region_active:: Bool = true )
@@ -118,7 +115,6 @@ deactivate_region(s::ModeState) = activate_region(s, false)
118
115
is_region_active (s:: PromptState ) = s. region_active
119
116
is_region_active (s:: ModeState ) = false
120
117
121
- const REGION_ANIMATION_DURATION = Ref (0.2 )
122
118
123
119
input_string (s:: PromptState ) = String (take! (copy (s. input_buffer)))
124
120
@@ -144,16 +140,11 @@ terminal(s::IO) = s
144
140
terminal (s:: PromptState ) = s. terminal
145
141
146
142
147
- # these may be better stored in Prompt or LineEditREPL
148
- const BEEP_DURATION = Ref (0.2 )
149
- const BEEP_BLINK = Ref (0.2 )
150
- const BEEP_MAXDURATION = Ref (1.0 )
151
- const BEEP_COLORS = [" \e [90m" ] # gray (text_colors not yet available)
152
- const BEEP_USE_CURRENT = Ref (true )
153
-
154
- function beep (s:: PromptState , duration:: Real = BEEP_DURATION[], blink:: Real = BEEP_BLINK[],
155
- maxduration:: Real = BEEP_MAXDURATION[];
156
- colors= BEEP_COLORS, use_current:: Bool = BEEP_USE_CURRENT[])
143
+ function beep (s:: PromptState , duration:: Real = options (s). beep_duration,
144
+ blink:: Real = options (s). beep_blink,
145
+ maxduration:: Real = options (s). beep_maxduration;
146
+ colors= options (s). beep_colors,
147
+ use_current:: Bool = options (s). beep_use_current)
157
148
isinteractive () || return # some tests fail on some platforms
158
149
s. beeping = min (s. beeping + duration, maxduration)
159
150
@async begin
@@ -855,7 +846,7 @@ function push_kill!(s::MIState, killed::String, concat = s.key_repeats > 0; rev=
855
846
s. kill_ring[end ] * killed
856
847
else
857
848
push! (s. kill_ring, killed)
858
- length (s. kill_ring) > KILL_RING_MAX[] && shift! (s. kill_ring)
849
+ length (s. kill_ring) > options (s) . kill_ring_max && shift! (s. kill_ring)
859
850
end
860
851
s. kill_idx = endof (s. kill_ring)
861
852
true
@@ -880,9 +871,9 @@ function edit_copy_region(s::MIState)
880
871
set_action! (s, :edit_copy_region )
881
872
buf = buffer (s)
882
873
push_kill! (s, content (buf, region (buf)), false ) || return :ignore
883
- if REGION_ANIMATION_DURATION[] > 0.0
874
+ if options (s) . region_animation_duration > 0.0
884
875
edit_exchange_point_and_mark (s)
885
- sleep (REGION_ANIMATION_DURATION[] )
876
+ sleep (options (s) . region_animation_duration )
886
877
edit_exchange_point_and_mark (s)
887
878
end
888
879
end
@@ -1822,16 +1813,7 @@ function commit_line(s)
1822
1813
state (s, mode (s)). ias = InputAreaState (0 , 0 )
1823
1814
end
1824
1815
1825
- """
1826
- `Base.LineEdit.tabwidth` controls the presumed tab width of code pasted into the REPL.
1827
-
1828
- You can modify it by doing `@eval Base.LineEdit tabwidth = 4`, for example.
1829
-
1830
- Must satisfy `0 < tabwidth <= 16`.
1831
- """
1832
- global tabwidth = 8
1833
-
1834
- function bracketed_paste (s)
1816
+ function bracketed_paste (s; tabwidth= options (s). tabwidth)
1835
1817
ps = state (s, mode (s))
1836
1818
str = readuntil (ps. terminal, " \e [201~" )
1837
1819
input = str[1 : prevind (str, end - 5 )]
0 commit comments