mirror of
https://github.com/ruby/ruby.git
synced 2025-08-25 22:14:37 +02:00
[ruby/reline] Separate prompt and input line in rendering
(https://github.com/ruby/reline/pull/652)
* Separate prompt and input line in rendering
Often, only one of prompt and input changes.
Split prompt+input_line to a separate rendering item will improve differential rendering performance.
* Rename method wrapped_prompt_lines to more descriptive name
16d82f1f23
This commit is contained in:
parent
f7d1699f67
commit
53a67efc9a
2 changed files with 19 additions and 12 deletions
|
@ -128,10 +128,10 @@ class Reline::Unicode
|
|||
end
|
||||
end
|
||||
|
||||
def self.split_by_width(str, max_width, encoding = str.encoding)
|
||||
def self.split_by_width(str, max_width, encoding = str.encoding, offset: 0)
|
||||
lines = [String.new(encoding: encoding)]
|
||||
height = 1
|
||||
width = 0
|
||||
width = offset
|
||||
rest = str.encode(Encoding::UTF_8)
|
||||
in_zero_width = false
|
||||
seq = String.new(encoding: encoding)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue