readline: move get_prompt_offset back to _linux.c.v (#7714)
parent
7872b8d911
commit
c943c8a16e
|
@ -41,17 +41,3 @@ mut:
|
|||
search_index int
|
||||
is_tty bool
|
||||
}
|
||||
|
||||
// get_prompt_offset computes the length of the `prompt` `string` argument.
|
||||
fn get_prompt_offset(prompt string) int {
|
||||
mut len := 0
|
||||
for i := 0; i < prompt.len; i++ {
|
||||
if prompt[i] == `\e` {
|
||||
for ; i < prompt.len && prompt[i] != `m`; i++ {
|
||||
}
|
||||
} else {
|
||||
len = len + 1
|
||||
}
|
||||
}
|
||||
return prompt.len - len
|
||||
}
|
||||
|
|
|
@ -333,6 +333,20 @@ fn calculate_screen_position(x_in int, y_in int, screen_columns int, char_count
|
|||
return out
|
||||
}
|
||||
|
||||
// get_prompt_offset computes the length of the `prompt` `string` argument.
|
||||
fn get_prompt_offset(prompt string) int {
|
||||
mut len := 0
|
||||
for i := 0; i < prompt.len; i++ {
|
||||
if prompt[i] == `\e` {
|
||||
for ; i < prompt.len && prompt[i] != `m`; i++ {
|
||||
}
|
||||
} else {
|
||||
len = len + 1
|
||||
}
|
||||
}
|
||||
return prompt.len - len
|
||||
}
|
||||
|
||||
// refresh_line redraws the current line, including the prompt.
|
||||
fn (mut r Readline) refresh_line() {
|
||||
mut end_of_input := [0, 0]
|
||||
|
|
Loading…
Reference in New Issue