class Reline::LineEditor

def calculate_nearest_cursor(line_to_calc = @line, cursor = @cursor, started_from = @started_from, byte_pointer = @byte_pointer, update = true)

def calculate_nearest_cursor(line_to_calc = @line, cursor = @cursor, started_from = @started_from, byte_pointer = @byte_pointer, update = true)
rsor_max = calculate_width(line_to_calc)
rsor = 0
te_pointer = 0
 = 1
dth = @screen_size.last
nfig.editing_mode_is?(:vi_command)
_byte_size = Reline::Unicode.get_prev_mbchar_size(line_to_calc, line_to_calc.bytesize)
ast_byte_size > 0
st_mbchar = line_to_calc.byteslice(line_to_calc.bytesize - last_byte_size, last_byte_size)
st_width = Reline::Unicode.get_mbchar_width(last_mbchar)
d_of_line_cursor = new_cursor_max - last_width

of_line_cursor = new_cursor_max
_line_cursor = new_cursor_max
o_calc.grapheme_clusters.each do |gc|
ar = gc.encode(Encoding::UTF_8)
ar_width = Reline::Unicode.get_mbchar_width(mbchar)
= new_cursor + mbchar_width
ow > end_of_line_cursor or now > cursor
eak
cursor += mbchar_width
ew_cursor > max_width * height
ight += 1
byte_pointer += gc.bytesize
arted_from = height - 1
ate
sor = new_cursor
sor_max = new_cursor_max
rted_from = new_started_from
e_pointer = new_byte_pointer
_cursor, new_cursor_max, new_started_from, new_byte_pointer]