mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
readline: move get_prompt_offset back to _linux.c.v (#7714)
This commit is contained in:
parent
7872b8d911
commit
c943c8a16e
@ -41,17 +41,3 @@ mut:
|
|||||||
search_index int
|
search_index int
|
||||||
is_tty bool
|
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
|
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.
|
// refresh_line redraws the current line, including the prompt.
|
||||||
fn (mut r Readline) refresh_line() {
|
fn (mut r Readline) refresh_line() {
|
||||||
mut end_of_input := [0, 0]
|
mut end_of_input := [0, 0]
|
||||||
|
Loading…
Reference in New Issue
Block a user