[ruby/reline] Use cached prompt list when just moved the cursor
https://github.com/ruby/reline/commit/cfe619460b
This commit is contained in:
parent
d4257c6152
commit
c2a5594e27
@ -80,7 +80,15 @@ class Reline::LineEditor
|
|||||||
end
|
end
|
||||||
return [prompt, calculate_width(prompt, true), [prompt] * buffer.size] if simplified_rendering?
|
return [prompt, calculate_width(prompt, true), [prompt] * buffer.size] if simplified_rendering?
|
||||||
if @prompt_proc
|
if @prompt_proc
|
||||||
if @cached_prompt_list and Time.now.to_f < (@prompt_cache_time + PROMPT_LIST_CACHE_TIMEOUT) and buffer.size == @cached_prompt_list.size
|
use_cached_prompt_list = false
|
||||||
|
if @cached_prompt_list
|
||||||
|
if @just_cursor_moving
|
||||||
|
use_cached_prompt_list = true
|
||||||
|
elsif Time.now.to_f < (@prompt_cache_time + PROMPT_LIST_CACHE_TIMEOUT) and buffer.size == @cached_prompt_list.size
|
||||||
|
use_cached_prompt_list = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if use_cached_prompt_list
|
||||||
prompt_list = @cached_prompt_list
|
prompt_list = @cached_prompt_list
|
||||||
else
|
else
|
||||||
prompt_list = @cached_prompt_list = @prompt_proc.(buffer)
|
prompt_list = @cached_prompt_list = @prompt_proc.(buffer)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user