ruby-changes:64292
From: aycabta <ko1@a...>
Date: Sat, 19 Dec 2020 02:24:14 +0900 (JST)
Subject: [ruby-changes:64292] c2a5594e27 (master): [ruby/reline] Use cached prompt list when just moved the cursor
https://git.ruby-lang.org/ruby.git/commit/?id=c2a5594e27 From c2a5594e271170b57f92d7461466f3c0ab8da863 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Sat, 19 Dec 2020 00:41:00 +0900 Subject: [ruby/reline] Use cached prompt list when just moved the cursor https://github.com/ruby/reline/commit/cfe619460b diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index f33b228..3637941 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -80,7 +80,15 @@ class Reline::LineEditor https://github.com/ruby/ruby/blob/trunk/lib/reline/line_editor.rb#L80 end return [prompt, calculate_width(prompt, true), [prompt] * buffer.size] if simplified_rendering? 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 else prompt_list = @cached_prompt_list = @prompt_proc.(buffer) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/