Using null_string
as either {sub}
and/or {flags}
to substitute()
at the script level works fine. The following script demonstrates that in its first three examples. (:1,10so
)
Further, {flags}
can be null_string
when substitute()
is within either a def
or lambda function. The fourth and fifth examples show that. (:1,23so
)
However, if {sub}
is null_string
in a def
or lambda function, gVim freezes for a moment, then crashes. In WSL, it also crashes, though there is a Segmentation fault message. (:so
) A screenshot follows the script showing what is generated.
[Windows gVim 9.1.1747 and WSL Vim 9.1.496]
vim9script
# '', '' works
echo 'Vimp'->substitute('p', '', '')
# '', null_string works
echo 'Vimp'->substitute('p', '', null_string)
# null_string, null_string works
echo 'Vimp'->substitute('p', null_string, null_string)
# def function with '', null_string works
def F1(s: string): string
return s->substitute('p', '', null_string)
enddef
echo 'Vimp'->F1()
# lambda function with '', null_string works
const F2: func = (s: string): string => {
return s->substitute('p', '', null_string)
}
echo 'Vimp'->F2()
# def function with null_string, null_string crashes Vim
def C1(s: string): string
return s->substitute('p', null_string, null_string)
enddef
echo 'Vimp'->C1()
# lambda function with null_string, null_string crashes Vim
const C2: func = (s: string): string => {
return s->substitute('p', null_string, null_string)
}
echo 'Vimp'->C2()
segmentation-fault.png (view on web)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Closed #18309 as completed via afa2a81.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.