In function UnicodeString WrapText(const UnicodeString & Line, int32_t MaxWidth) the MaxWidth param is not max width, actual max width is always less than that.
DialogMessage has edge cases when buttons go out of borders
A long text line that should fit the whole client area width of DialogMessage has inconsistent spacing: 1 space on the left (correct) and 2 spaces on the right (should be 1 space):
|| Long text || - before fix
|| Long text || - after fix
An example of buttons going out of borders:
An example of fixed dialog, that also shows correct spacing and text wrapping:
@michaellukashov, You should also fix test1 function in the file tests/testnetbox_02.cpp in far3-dev-tests branch:
REQUIRE_EQUAL(3, MessageLines.GetCount());
REQUIRE_EQUAL(L"long long long long", MessageLines.GetString(0));
REQUIRE_EQUAL("long long long long", W2MB(MessageLines.GetString(1).c_str()));
REQUIRE_EQUAL("long text", W2MB(MessageLines.GetString(2).c_str()));
This PR fixes this issues:
UnicodeString WrapText(const UnicodeString & Line, int32_t MaxWidth)
theMaxWidth
param is not max width, actual max width is always less than that.DialogMessage
has edge cases when buttons go out of bordersDialogMessage
has inconsistent spacing: 1 space on the left (correct) and 2 spaces on the right (should be 1 space):|| Long text ||
- before fix|| Long text ||
- after fixAn example of buttons going out of borders:![before](https://github.com/michaellukashov/Far-NetBox/assets/79405160/d17db061-381b-40a0-aff8-2a0498ebf500)
An example of fixed dialog, that also shows correct spacing and text wrapping:![after](https://github.com/michaellukashov/Far-NetBox/assets/79405160/87eab4e4-2291-4f26-8b99-9fef96112f61)
@michaellukashov, You should also fix
test1
function in the filetests/testnetbox_02.cpp
infar3-dev-tests
branch: