Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/smanonr..../opt/alt/ruby31/share/ruby
File: reline.rb
require 'io/console'
[0] Fix | Delete
require 'timeout'
[1] Fix | Delete
require 'forwardable'
[2] Fix | Delete
require 'reline/version'
[3] Fix | Delete
require 'reline/config'
[4] Fix | Delete
require 'reline/key_actor'
[5] Fix | Delete
require 'reline/key_stroke'
[6] Fix | Delete
require 'reline/line_editor'
[7] Fix | Delete
require 'reline/history'
[8] Fix | Delete
require 'reline/terminfo'
[9] Fix | Delete
require 'rbconfig'
[10] Fix | Delete
[11] Fix | Delete
module Reline
[12] Fix | Delete
FILENAME_COMPLETION_PROC = nil
[13] Fix | Delete
USERNAME_COMPLETION_PROC = nil
[14] Fix | Delete
[15] Fix | Delete
class ConfigEncodingConversionError < StandardError; end
[16] Fix | Delete
[17] Fix | Delete
Key = Struct.new('Key', :char, :combined_char, :with_meta) do
[18] Fix | Delete
def match?(other)
[19] Fix | Delete
case other
[20] Fix | Delete
when Reline::Key
[21] Fix | Delete
(other.char.nil? or char.nil? or char == other.char) and
[22] Fix | Delete
(other.combined_char.nil? or combined_char.nil? or combined_char == other.combined_char) and
[23] Fix | Delete
(other.with_meta.nil? or with_meta.nil? or with_meta == other.with_meta)
[24] Fix | Delete
when Integer, Symbol
[25] Fix | Delete
(combined_char and combined_char == other) or
[26] Fix | Delete
(combined_char.nil? and char and char == other)
[27] Fix | Delete
else
[28] Fix | Delete
false
[29] Fix | Delete
end
[30] Fix | Delete
end
[31] Fix | Delete
alias_method :==, :match?
[32] Fix | Delete
end
[33] Fix | Delete
CursorPos = Struct.new(:x, :y)
[34] Fix | Delete
DialogRenderInfo = Struct.new(:pos, :contents, :bg_color, :width, :height, :scrollbar, keyword_init: true)
[35] Fix | Delete
[36] Fix | Delete
class Core
[37] Fix | Delete
ATTR_READER_NAMES = %i(
[38] Fix | Delete
completion_append_character
[39] Fix | Delete
basic_word_break_characters
[40] Fix | Delete
completer_word_break_characters
[41] Fix | Delete
basic_quote_characters
[42] Fix | Delete
completer_quote_characters
[43] Fix | Delete
filename_quote_characters
[44] Fix | Delete
special_prefixes
[45] Fix | Delete
completion_proc
[46] Fix | Delete
output_modifier_proc
[47] Fix | Delete
prompt_proc
[48] Fix | Delete
auto_indent_proc
[49] Fix | Delete
pre_input_hook
[50] Fix | Delete
dig_perfect_match_proc
[51] Fix | Delete
).each(&method(:attr_reader))
[52] Fix | Delete
[53] Fix | Delete
attr_accessor :config
[54] Fix | Delete
attr_accessor :key_stroke
[55] Fix | Delete
attr_accessor :line_editor
[56] Fix | Delete
attr_accessor :last_incremental_search
[57] Fix | Delete
attr_reader :output
[58] Fix | Delete
[59] Fix | Delete
def initialize
[60] Fix | Delete
self.output = STDOUT
[61] Fix | Delete
@dialog_proc_list = {}
[62] Fix | Delete
yield self
[63] Fix | Delete
@completion_quote_character = nil
[64] Fix | Delete
@bracketed_paste_finished = false
[65] Fix | Delete
end
[66] Fix | Delete
[67] Fix | Delete
def encoding
[68] Fix | Delete
Reline::IOGate.encoding
[69] Fix | Delete
end
[70] Fix | Delete
[71] Fix | Delete
def completion_append_character=(val)
[72] Fix | Delete
if val.nil?
[73] Fix | Delete
@completion_append_character = nil
[74] Fix | Delete
elsif val.size == 1
[75] Fix | Delete
@completion_append_character = val.encode(Reline::IOGate.encoding)
[76] Fix | Delete
elsif val.size > 1
[77] Fix | Delete
@completion_append_character = val[0].encode(Reline::IOGate.encoding)
[78] Fix | Delete
else
[79] Fix | Delete
@completion_append_character = nil
[80] Fix | Delete
end
[81] Fix | Delete
end
[82] Fix | Delete
[83] Fix | Delete
def basic_word_break_characters=(v)
[84] Fix | Delete
@basic_word_break_characters = v.encode(Reline::IOGate.encoding)
[85] Fix | Delete
end
[86] Fix | Delete
[87] Fix | Delete
def completer_word_break_characters=(v)
[88] Fix | Delete
@completer_word_break_characters = v.encode(Reline::IOGate.encoding)
[89] Fix | Delete
end
[90] Fix | Delete
[91] Fix | Delete
def basic_quote_characters=(v)
[92] Fix | Delete
@basic_quote_characters = v.encode(Reline::IOGate.encoding)
[93] Fix | Delete
end
[94] Fix | Delete
[95] Fix | Delete
def completer_quote_characters=(v)
[96] Fix | Delete
@completer_quote_characters = v.encode(Reline::IOGate.encoding)
[97] Fix | Delete
end
[98] Fix | Delete
[99] Fix | Delete
def filename_quote_characters=(v)
[100] Fix | Delete
@filename_quote_characters = v.encode(Reline::IOGate.encoding)
[101] Fix | Delete
end
[102] Fix | Delete
[103] Fix | Delete
def special_prefixes=(v)
[104] Fix | Delete
@special_prefixes = v.encode(Reline::IOGate.encoding)
[105] Fix | Delete
end
[106] Fix | Delete
[107] Fix | Delete
def completion_case_fold=(v)
[108] Fix | Delete
@config.completion_ignore_case = v
[109] Fix | Delete
end
[110] Fix | Delete
[111] Fix | Delete
def completion_case_fold
[112] Fix | Delete
@config.completion_ignore_case
[113] Fix | Delete
end
[114] Fix | Delete
[115] Fix | Delete
def completion_quote_character
[116] Fix | Delete
@completion_quote_character
[117] Fix | Delete
end
[118] Fix | Delete
[119] Fix | Delete
def completion_proc=(p)
[120] Fix | Delete
raise ArgumentError unless p.respond_to?(:call) or p.nil?
[121] Fix | Delete
@completion_proc = p
[122] Fix | Delete
end
[123] Fix | Delete
[124] Fix | Delete
def autocompletion
[125] Fix | Delete
@config.autocompletion
[126] Fix | Delete
end
[127] Fix | Delete
[128] Fix | Delete
def autocompletion=(val)
[129] Fix | Delete
@config.autocompletion = val
[130] Fix | Delete
end
[131] Fix | Delete
[132] Fix | Delete
def output_modifier_proc=(p)
[133] Fix | Delete
raise ArgumentError unless p.respond_to?(:call) or p.nil?
[134] Fix | Delete
@output_modifier_proc = p
[135] Fix | Delete
end
[136] Fix | Delete
[137] Fix | Delete
def prompt_proc=(p)
[138] Fix | Delete
raise ArgumentError unless p.respond_to?(:call) or p.nil?
[139] Fix | Delete
@prompt_proc = p
[140] Fix | Delete
end
[141] Fix | Delete
[142] Fix | Delete
def auto_indent_proc=(p)
[143] Fix | Delete
raise ArgumentError unless p.respond_to?(:call) or p.nil?
[144] Fix | Delete
@auto_indent_proc = p
[145] Fix | Delete
end
[146] Fix | Delete
[147] Fix | Delete
def pre_input_hook=(p)
[148] Fix | Delete
@pre_input_hook = p
[149] Fix | Delete
end
[150] Fix | Delete
[151] Fix | Delete
def dig_perfect_match_proc=(p)
[152] Fix | Delete
raise ArgumentError unless p.respond_to?(:call) or p.nil?
[153] Fix | Delete
@dig_perfect_match_proc = p
[154] Fix | Delete
end
[155] Fix | Delete
[156] Fix | Delete
DialogProc = Struct.new(:dialog_proc, :context)
[157] Fix | Delete
def add_dialog_proc(name_sym, p, context = nil)
[158] Fix | Delete
raise ArgumentError unless p.respond_to?(:call) or p.nil?
[159] Fix | Delete
raise ArgumentError unless name_sym.instance_of?(Symbol)
[160] Fix | Delete
@dialog_proc_list[name_sym] = DialogProc.new(p, context)
[161] Fix | Delete
end
[162] Fix | Delete
[163] Fix | Delete
def dialog_proc(name_sym)
[164] Fix | Delete
@dialog_proc_list[name_sym]
[165] Fix | Delete
end
[166] Fix | Delete
[167] Fix | Delete
def input=(val)
[168] Fix | Delete
raise TypeError unless val.respond_to?(:getc) or val.nil?
[169] Fix | Delete
if val.respond_to?(:getc)
[170] Fix | Delete
if defined?(Reline::ANSI) and Reline::IOGate == Reline::ANSI
[171] Fix | Delete
Reline::ANSI.input = val
[172] Fix | Delete
elsif Reline::IOGate == Reline::GeneralIO
[173] Fix | Delete
Reline::GeneralIO.input = val
[174] Fix | Delete
end
[175] Fix | Delete
end
[176] Fix | Delete
end
[177] Fix | Delete
[178] Fix | Delete
def output=(val)
[179] Fix | Delete
raise TypeError unless val.respond_to?(:write) or val.nil?
[180] Fix | Delete
@output = val
[181] Fix | Delete
if defined?(Reline::ANSI) and Reline::IOGate == Reline::ANSI
[182] Fix | Delete
Reline::ANSI.output = val
[183] Fix | Delete
end
[184] Fix | Delete
end
[185] Fix | Delete
[186] Fix | Delete
def vi_editing_mode
[187] Fix | Delete
config.editing_mode = :vi_insert
[188] Fix | Delete
nil
[189] Fix | Delete
end
[190] Fix | Delete
[191] Fix | Delete
def emacs_editing_mode
[192] Fix | Delete
config.editing_mode = :emacs
[193] Fix | Delete
nil
[194] Fix | Delete
end
[195] Fix | Delete
[196] Fix | Delete
def vi_editing_mode?
[197] Fix | Delete
config.editing_mode_is?(:vi_insert, :vi_command)
[198] Fix | Delete
end
[199] Fix | Delete
[200] Fix | Delete
def emacs_editing_mode?
[201] Fix | Delete
config.editing_mode_is?(:emacs)
[202] Fix | Delete
end
[203] Fix | Delete
[204] Fix | Delete
def get_screen_size
[205] Fix | Delete
Reline::IOGate.get_screen_size
[206] Fix | Delete
end
[207] Fix | Delete
[208] Fix | Delete
Reline::DEFAULT_DIALOG_PROC_AUTOCOMPLETE = ->() {
[209] Fix | Delete
# autocomplete
[210] Fix | Delete
return nil unless config.autocompletion
[211] Fix | Delete
if just_cursor_moving and completion_journey_data.nil?
[212] Fix | Delete
# Auto complete starts only when edited
[213] Fix | Delete
return nil
[214] Fix | Delete
end
[215] Fix | Delete
pre, target, post = retrieve_completion_block(true)
[216] Fix | Delete
if target.nil? or target.empty? or (completion_journey_data&.pointer == -1 and target.size <= 3)
[217] Fix | Delete
return nil
[218] Fix | Delete
end
[219] Fix | Delete
if completion_journey_data and completion_journey_data.list
[220] Fix | Delete
result = completion_journey_data.list.dup
[221] Fix | Delete
result.shift
[222] Fix | Delete
pointer = completion_journey_data.pointer - 1
[223] Fix | Delete
else
[224] Fix | Delete
result = call_completion_proc_with_checking_args(pre, target, post)
[225] Fix | Delete
pointer = nil
[226] Fix | Delete
end
[227] Fix | Delete
if result and result.size == 1 and result[0] == target and pointer != 0
[228] Fix | Delete
result = nil
[229] Fix | Delete
end
[230] Fix | Delete
target_width = Reline::Unicode.calculate_width(target)
[231] Fix | Delete
x = cursor_pos.x - target_width
[232] Fix | Delete
if x < 0
[233] Fix | Delete
x = screen_width + x
[234] Fix | Delete
y = -1
[235] Fix | Delete
else
[236] Fix | Delete
y = 0
[237] Fix | Delete
end
[238] Fix | Delete
cursor_pos_to_render = Reline::CursorPos.new(x, y)
[239] Fix | Delete
if context and context.is_a?(Array)
[240] Fix | Delete
context.clear
[241] Fix | Delete
context.push(cursor_pos_to_render, result, pointer, dialog)
[242] Fix | Delete
end
[243] Fix | Delete
dialog.pointer = pointer
[244] Fix | Delete
DialogRenderInfo.new(pos: cursor_pos_to_render, contents: result, scrollbar: true, height: 15)
[245] Fix | Delete
}
[246] Fix | Delete
Reline::DEFAULT_DIALOG_CONTEXT = Array.new
[247] Fix | Delete
[248] Fix | Delete
def readmultiline(prompt = '', add_hist = false, &confirm_multiline_termination)
[249] Fix | Delete
unless confirm_multiline_termination
[250] Fix | Delete
raise ArgumentError.new('#readmultiline needs block to confirm multiline termination')
[251] Fix | Delete
end
[252] Fix | Delete
inner_readline(prompt, add_hist, true, &confirm_multiline_termination)
[253] Fix | Delete
[254] Fix | Delete
whole_buffer = line_editor.whole_buffer.dup
[255] Fix | Delete
whole_buffer.taint if RUBY_VERSION < '2.7'
[256] Fix | Delete
if add_hist and whole_buffer and whole_buffer.chomp("\n").size > 0
[257] Fix | Delete
Reline::HISTORY << whole_buffer
[258] Fix | Delete
end
[259] Fix | Delete
[260] Fix | Delete
line_editor.reset_line if line_editor.whole_buffer.nil?
[261] Fix | Delete
whole_buffer
[262] Fix | Delete
end
[263] Fix | Delete
[264] Fix | Delete
def readline(prompt = '', add_hist = false)
[265] Fix | Delete
inner_readline(prompt, add_hist, false)
[266] Fix | Delete
[267] Fix | Delete
line = line_editor.line.dup
[268] Fix | Delete
line.taint if RUBY_VERSION < '2.7'
[269] Fix | Delete
if add_hist and line and line.chomp("\n").size > 0
[270] Fix | Delete
Reline::HISTORY << line.chomp("\n")
[271] Fix | Delete
end
[272] Fix | Delete
[273] Fix | Delete
line_editor.reset_line if line_editor.line.nil?
[274] Fix | Delete
line
[275] Fix | Delete
end
[276] Fix | Delete
[277] Fix | Delete
private def inner_readline(prompt, add_hist, multiline, &confirm_multiline_termination)
[278] Fix | Delete
if ENV['RELINE_STDERR_TTY']
[279] Fix | Delete
if Reline::IOGate.win?
[280] Fix | Delete
$stderr = File.open(ENV['RELINE_STDERR_TTY'], 'a')
[281] Fix | Delete
else
[282] Fix | Delete
$stderr.reopen(ENV['RELINE_STDERR_TTY'], 'w')
[283] Fix | Delete
end
[284] Fix | Delete
$stderr.sync = true
[285] Fix | Delete
$stderr.puts "Reline is used by #{Process.pid}"
[286] Fix | Delete
end
[287] Fix | Delete
otio = Reline::IOGate.prep
[288] Fix | Delete
[289] Fix | Delete
may_req_ambiguous_char_width
[290] Fix | Delete
line_editor.reset(prompt, encoding: Reline::IOGate.encoding)
[291] Fix | Delete
if multiline
[292] Fix | Delete
line_editor.multiline_on
[293] Fix | Delete
if block_given?
[294] Fix | Delete
line_editor.confirm_multiline_termination_proc = confirm_multiline_termination
[295] Fix | Delete
end
[296] Fix | Delete
else
[297] Fix | Delete
line_editor.multiline_off
[298] Fix | Delete
end
[299] Fix | Delete
line_editor.output = output
[300] Fix | Delete
line_editor.completion_proc = completion_proc
[301] Fix | Delete
line_editor.completion_append_character = completion_append_character
[302] Fix | Delete
line_editor.output_modifier_proc = output_modifier_proc
[303] Fix | Delete
line_editor.prompt_proc = prompt_proc
[304] Fix | Delete
line_editor.auto_indent_proc = auto_indent_proc
[305] Fix | Delete
line_editor.dig_perfect_match_proc = dig_perfect_match_proc
[306] Fix | Delete
line_editor.pre_input_hook = pre_input_hook
[307] Fix | Delete
@dialog_proc_list.each_pair do |name_sym, d|
[308] Fix | Delete
line_editor.add_dialog_proc(name_sym, d.dialog_proc, d.context)
[309] Fix | Delete
end
[310] Fix | Delete
[311] Fix | Delete
unless config.test_mode
[312] Fix | Delete
config.read
[313] Fix | Delete
config.reset_default_key_bindings
[314] Fix | Delete
Reline::IOGate.set_default_key_bindings(config)
[315] Fix | Delete
end
[316] Fix | Delete
[317] Fix | Delete
line_editor.rerender
[318] Fix | Delete
[319] Fix | Delete
begin
[320] Fix | Delete
line_editor.set_signal_handlers
[321] Fix | Delete
prev_pasting_state = false
[322] Fix | Delete
loop do
[323] Fix | Delete
prev_pasting_state = Reline::IOGate.in_pasting?
[324] Fix | Delete
read_io(config.keyseq_timeout) { |inputs|
[325] Fix | Delete
line_editor.set_pasting_state(Reline::IOGate.in_pasting?)
[326] Fix | Delete
inputs.each { |c|
[327] Fix | Delete
line_editor.input_key(c)
[328] Fix | Delete
line_editor.rerender
[329] Fix | Delete
}
[330] Fix | Delete
if @bracketed_paste_finished
[331] Fix | Delete
line_editor.rerender_all
[332] Fix | Delete
@bracketed_paste_finished = false
[333] Fix | Delete
end
[334] Fix | Delete
}
[335] Fix | Delete
if prev_pasting_state == true and not Reline::IOGate.in_pasting? and not line_editor.finished?
[336] Fix | Delete
line_editor.set_pasting_state(false)
[337] Fix | Delete
prev_pasting_state = false
[338] Fix | Delete
line_editor.rerender_all
[339] Fix | Delete
end
[340] Fix | Delete
break if line_editor.finished?
[341] Fix | Delete
end
[342] Fix | Delete
Reline::IOGate.move_cursor_column(0)
[343] Fix | Delete
rescue Errno::EIO
[344] Fix | Delete
# Maybe the I/O has been closed.
[345] Fix | Delete
rescue StandardError => e
[346] Fix | Delete
line_editor.finalize
[347] Fix | Delete
Reline::IOGate.deprep(otio)
[348] Fix | Delete
raise e
[349] Fix | Delete
rescue Exception
[350] Fix | Delete
# Including Interrupt
[351] Fix | Delete
line_editor.finalize
[352] Fix | Delete
Reline::IOGate.deprep(otio)
[353] Fix | Delete
raise
[354] Fix | Delete
end
[355] Fix | Delete
[356] Fix | Delete
line_editor.finalize
[357] Fix | Delete
Reline::IOGate.deprep(otio)
[358] Fix | Delete
end
[359] Fix | Delete
[360] Fix | Delete
# GNU Readline waits for "keyseq-timeout" milliseconds to see if the ESC
[361] Fix | Delete
# is followed by a character, and times out and treats it as a standalone
[362] Fix | Delete
# ESC if the second character does not arrive. If the second character
[363] Fix | Delete
# comes before timed out, it is treated as a modifier key with the
[364] Fix | Delete
# meta-property of meta-key, so that it can be distinguished from
[365] Fix | Delete
# multibyte characters with the 8th bit turned on.
[366] Fix | Delete
#
[367] Fix | Delete
# GNU Readline will wait for the 2nd character with "keyseq-timeout"
[368] Fix | Delete
# milli-seconds but wait forever after 3rd characters.
[369] Fix | Delete
private def read_io(keyseq_timeout, &block)
[370] Fix | Delete
buffer = []
[371] Fix | Delete
loop do
[372] Fix | Delete
c = Reline::IOGate.getc
[373] Fix | Delete
if c == -1
[374] Fix | Delete
result = :unmatched
[375] Fix | Delete
@bracketed_paste_finished = true
[376] Fix | Delete
else
[377] Fix | Delete
buffer << c
[378] Fix | Delete
result = key_stroke.match_status(buffer)
[379] Fix | Delete
end
[380] Fix | Delete
case result
[381] Fix | Delete
when :matched
[382] Fix | Delete
expanded = key_stroke.expand(buffer).map{ |expanded_c|
[383] Fix | Delete
Reline::Key.new(expanded_c, expanded_c, false)
[384] Fix | Delete
}
[385] Fix | Delete
block.(expanded)
[386] Fix | Delete
break
[387] Fix | Delete
when :matching
[388] Fix | Delete
if buffer.size == 1
[389] Fix | Delete
case read_2nd_character_of_key_sequence(keyseq_timeout, buffer, c, block)
[390] Fix | Delete
when :break then break
[391] Fix | Delete
when :next then next
[392] Fix | Delete
end
[393] Fix | Delete
end
[394] Fix | Delete
when :unmatched
[395] Fix | Delete
if buffer.size == 1 and c == "\e".ord
[396] Fix | Delete
read_escaped_key(keyseq_timeout, c, block)
[397] Fix | Delete
else
[398] Fix | Delete
expanded = buffer.map{ |expanded_c|
[399] Fix | Delete
Reline::Key.new(expanded_c, expanded_c, false)
[400] Fix | Delete
}
[401] Fix | Delete
block.(expanded)
[402] Fix | Delete
end
[403] Fix | Delete
break
[404] Fix | Delete
end
[405] Fix | Delete
end
[406] Fix | Delete
end
[407] Fix | Delete
[408] Fix | Delete
private def read_2nd_character_of_key_sequence(keyseq_timeout, buffer, c, block)
[409] Fix | Delete
begin
[410] Fix | Delete
succ_c = nil
[411] Fix | Delete
Timeout.timeout(keyseq_timeout / 1000.0) {
[412] Fix | Delete
succ_c = Reline::IOGate.getc
[413] Fix | Delete
}
[414] Fix | Delete
rescue Timeout::Error # cancel matching only when first byte
[415] Fix | Delete
block.([Reline::Key.new(c, c, false)])
[416] Fix | Delete
return :break
[417] Fix | Delete
else
[418] Fix | Delete
case key_stroke.match_status(buffer.dup.push(succ_c))
[419] Fix | Delete
when :unmatched
[420] Fix | Delete
if c == "\e".ord
[421] Fix | Delete
block.([Reline::Key.new(succ_c, succ_c | 0b10000000, true)])
[422] Fix | Delete
else
[423] Fix | Delete
block.([Reline::Key.new(c, c, false), Reline::Key.new(succ_c, succ_c, false)])
[424] Fix | Delete
end
[425] Fix | Delete
return :break
[426] Fix | Delete
when :matching
[427] Fix | Delete
Reline::IOGate.ungetc(succ_c)
[428] Fix | Delete
return :next
[429] Fix | Delete
when :matched
[430] Fix | Delete
buffer << succ_c
[431] Fix | Delete
expanded = key_stroke.expand(buffer).map{ |expanded_c|
[432] Fix | Delete
Reline::Key.new(expanded_c, expanded_c, false)
[433] Fix | Delete
}
[434] Fix | Delete
block.(expanded)
[435] Fix | Delete
return :break
[436] Fix | Delete
end
[437] Fix | Delete
end
[438] Fix | Delete
end
[439] Fix | Delete
[440] Fix | Delete
private def read_escaped_key(keyseq_timeout, c, block)
[441] Fix | Delete
begin
[442] Fix | Delete
escaped_c = nil
[443] Fix | Delete
Timeout.timeout(keyseq_timeout / 1000.0) {
[444] Fix | Delete
escaped_c = Reline::IOGate.getc
[445] Fix | Delete
}
[446] Fix | Delete
rescue Timeout::Error # independent ESC
[447] Fix | Delete
block.([Reline::Key.new(c, c, false)])
[448] Fix | Delete
else
[449] Fix | Delete
if escaped_c.nil?
[450] Fix | Delete
block.([Reline::Key.new(c, c, false)])
[451] Fix | Delete
elsif escaped_c >= 128 # maybe, first byte of multi byte
[452] Fix | Delete
block.([Reline::Key.new(c, c, false), Reline::Key.new(escaped_c, escaped_c, false)])
[453] Fix | Delete
elsif escaped_c == "\e".ord # escape twice
[454] Fix | Delete
block.([Reline::Key.new(c, c, false), Reline::Key.new(c, c, false)])
[455] Fix | Delete
else
[456] Fix | Delete
block.([Reline::Key.new(escaped_c, escaped_c | 0b10000000, true)])
[457] Fix | Delete
end
[458] Fix | Delete
end
[459] Fix | Delete
end
[460] Fix | Delete
[461] Fix | Delete
def ambiguous_width
[462] Fix | Delete
may_req_ambiguous_char_width unless defined? @ambiguous_width
[463] Fix | Delete
@ambiguous_width
[464] Fix | Delete
end
[465] Fix | Delete
[466] Fix | Delete
private def may_req_ambiguous_char_width
[467] Fix | Delete
@ambiguous_width = 2 if Reline::IOGate == Reline::GeneralIO or STDOUT.is_a?(File)
[468] Fix | Delete
return if defined? @ambiguous_width
[469] Fix | Delete
Reline::IOGate.move_cursor_column(0)
[470] Fix | Delete
begin
[471] Fix | Delete
output.write "\u{25bd}"
[472] Fix | Delete
rescue Encoding::UndefinedConversionError
[473] Fix | Delete
# LANG=C
[474] Fix | Delete
@ambiguous_width = 1
[475] Fix | Delete
else
[476] Fix | Delete
@ambiguous_width = Reline::IOGate.cursor_pos.x
[477] Fix | Delete
end
[478] Fix | Delete
Reline::IOGate.move_cursor_column(0)
[479] Fix | Delete
Reline::IOGate.erase_after_cursor
[480] Fix | Delete
end
[481] Fix | Delete
end
[482] Fix | Delete
[483] Fix | Delete
extend Forwardable
[484] Fix | Delete
extend SingleForwardable
[485] Fix | Delete
[486] Fix | Delete
#--------------------------------------------------------
[487] Fix | Delete
# Documented API
[488] Fix | Delete
#--------------------------------------------------------
[489] Fix | Delete
[490] Fix | Delete
(Core::ATTR_READER_NAMES).each { |name|
[491] Fix | Delete
def_single_delegators :core, :"#{name}", :"#{name}="
[492] Fix | Delete
}
[493] Fix | Delete
def_single_delegators :core, :input=, :output=
[494] Fix | Delete
def_single_delegators :core, :vi_editing_mode, :emacs_editing_mode
[495] Fix | Delete
def_single_delegators :core, :readline
[496] Fix | Delete
def_single_delegators :core, :completion_case_fold, :completion_case_fold=
[497] Fix | Delete
def_single_delegators :core, :completion_quote_character
[498] Fix | Delete
def_instance_delegators self, :readline
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function