def append_to_match(text, delimiter, quote_char, nontrivial_match)
temp_string = 0.chr * 4
temp_string_index = 0
if (quote_char && @rl_point>0 && !@rl_completion_suppress_quote &&
@rl_line_buffer[@rl_point - 1,1] != quote_char)
temp_string[temp_string_index] = quote_char
temp_string_index += 1
end
if (delimiter != 0.chr)
temp_string[temp_string_index] = delimiter
temp_string_index += 1
elsif (!@rl_completion_suppress_append && @rl_completion_append_character)
temp_string[temp_string_index] = @rl_completion_append_character
temp_string_index += 1
end
temp_string[temp_string_index] = 0.chr
temp_string_index += 1
if (@rl_filename_completion_desired)
filename = File.expand_path(text)
s = (nontrivial_match && !@rl_completion_mark_symlink_dirs) ?
File.lstat(filename) : File.stat(filename)
if s.directory?
if @_rl_complete_mark_directories
if (@rl_point>0 && @rl_line_buffer[@rl_point,1] == 0.chr && @rl_line_buffer[@rl_point - 1,1] == '/' )
elsif (@rl_line_buffer[@rl_point,1] != '/')
rl_insert_text('/')
end
end
elsif s.symlink? && File.stat(filename).directory?
else
if (@rl_point == @rl_end && temp_string_index>0)
rl_insert_text(temp_string)
end
end
filename = nil
else
if (@rl_point == @rl_end && temp_string_index>0)
rl_insert_text(temp_string)
end
end
temp_string_index
end