https://bugs.documentfoundation.org/show_bug.cgi?id=126913

--- Comment #5 from Julien Nabet <serval2...@yahoo.fr> ---
With this patch:
diff --git a/basic/source/runtime/methods.cxx
b/basic/source/runtime/methods.cxx
index fe266fdc009c..777b21040230 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -1159,7 +1159,7 @@ void SbRtl_Mid(StarBASIC *, SbxArray & rPar, bool bWrite)

                 OUStringBuffer aResultStr = aArgStr;
                 sal_Int32 nErase = nReplaceLen;
-                aResultStr.remove( nStartPos, nErase );
+                aResultStr.remove( nStartPos, nErase - nStartPos);
                 aResultStr.insert(
                     nStartPos, aReplaceStr.getStr(), std::min(nReplaceLen,
nReplaceStrLen));

it works.
But this unit test fails:
    s = "The lightbrown fox"
    Mid(s, 5, 10, "lazy")
it expects:
"The lazy fox"
but with the patch I get:
"The lazyrown fox"

Perhaps, I could use "nErase - nStartPos" only when using VBASupport 1
but:
1) Still I don't know if the patch is right
2) Changing behaviour of mid function may bring some regressions for some other
users

=> There's no more Basic expert in
https://wiki.documentfoundation.org/FindTheExpert, so I'm a bit stuck.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to