In a new Basic module, replace all boilerplate with this code: Function Foo() If 0 Then print 1 If 0 Then _ print 1 If 0 Then _ print 1 End Function Sub Bar print "Bar" End Sub Note that all If statements there are using single-line syntax without EndIf, and last two of them are written in two lines each, with "_" to break the line into two. Now try to put cursor into Bar, on the line with "print 1", and press F5 to run it. Instead of executing it, it will open LibreOffice Basic Macros dialog, as if you had put cursor outside of any macro. The same result would be when you put cursor to the last line of Bar (with "End Sub"), but Bar would run if you put cursor to "Sub Bar", *or to the line just above*, or even *if you put cursor to the last line of Foo (with "End Function")*! This shows that IDE treats lines incorrectly, shifting by 2 lines. If you replace any of the two-lined Ifs into a single-lined If (to look like the first If), then the shift will become 1 line; and replacing both 2-lined Ifs with 1-lined variant makes it all OK. Also the same problem is with putting breakpoints. Tested with Version: 6.3.3.1 (x64) Build ID: f41f4c7f9507aeca13cb9df51f34d80e8ba30a99 CPU threads: 12; OS: Windows 10.0; UI render: GL; VCL: win; Locale: ru-RU (ru_RU); UI-Language: en-US Calc: threaded and also with OpenOffice.org 3.2.0 OOO320m12 (Build:9483) - in that old version, only Main is run when you press F5, so the problem is only visible as breakpoint displacement.
reproducible
https://gerrit.libreoffice.org/81204
Mike Kaganski committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/7199f8c91fea3d3812b08539274eb3e73a7af69c tdf#128263: update push positions in single line IF It will be available in 6.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.