@@ -47,6 +47,7 @@ def initialize(prompt, prompt_char = '>', histfile = nil, framework = nil)
47
47
# Initialize the prompt
48
48
self . init_prompt = prompt
49
49
self . cont_prompt = ' > '
50
+ self . cont_flag = false
50
51
self . prompt_char = prompt_char
51
52
52
53
self . histfile = histfile
@@ -57,7 +58,8 @@ def initialize(prompt, prompt_char = '>', histfile = nil, framework = nil)
57
58
58
59
def init_tab_complete
59
60
if ( self . input and self . input . supports_readline )
60
- self . input = Input ::Readline . new ( lambda { |str | tab_complete ( str ) } )
61
+ # Unless cont_flag because there's no tab complete for continuation lines
62
+ self . input = Input ::Readline . new ( lambda { |str | tab_complete ( str ) unless cont_flag } )
61
63
if Readline ::HISTORY . length == 0 and histfile and File . exist? ( histfile )
62
64
File . readlines ( histfile ) . each { |e |
63
65
Readline ::HISTORY << e . chomp
@@ -355,13 +357,15 @@ def get_input_line
355
357
line = "\\ \n "
356
358
prompt_needs_reset = false
357
359
360
+ self . cont_flag = false
358
361
while line =~ /(^|[^\\ ])\\ \s *$/
359
362
# Strip \ and all the trailing whitespace
360
363
line . sub! ( /\\ \s */ , '' )
361
364
362
365
if line . length > 0
363
366
# Using update_prompt will overwrite the primary prompt
364
367
input . prompt = output . update_prompt ( self . cont_prompt )
368
+ self . cont_flag = true
365
369
prompt_needs_reset = true
366
370
end
367
371
@@ -370,6 +374,7 @@ def get_input_line
370
374
output . input = nil
371
375
log_output ( input . prompt )
372
376
end
377
+ self . cont_flag = false
373
378
374
379
if prompt_needs_reset
375
380
# The continuation prompt was used so reset the prompt
@@ -424,6 +429,11 @@ def log_output(buf)
424
429
attr_accessor :histfile # :nodoc:
425
430
attr_accessor :hist_last_saved # the number of history lines when last saved/loaded
426
431
attr_accessor :log_source , :stop_count # :nodoc:
432
+ attr_reader :cont_flag # :nodoc:
433
+
434
+ private
435
+
436
+ attr_writer :cont_flag # :nodoc:
427
437
428
438
end
429
439
0 commit comments