Skip to content

Commit

Permalink
fix EditSurroundingWord
Browse files Browse the repository at this point in the history
  • Loading branch information
dinhngtu committed Feb 24, 2024
1 parent 6fa09fd commit 3773d22
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions VietTypeATL/EditSurroundingWord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,16 @@ static HRESULT DoEditSurroundingWord(
hr = rangeTest->ShiftStart(ec, -SWF_MAXCHARS, &shifted, &haltcond);
HRESULT_CHECK_RETURN(hr, L"%s", L"rangeTest->ShiftStart failed");

if (!shifted) {
if (shifted >= 0) {
return E_NOTIMPL;
}
shifted = -shifted;

// find word boundary

std::array<WCHAR, SWF_MAXCHARS> buf;
ULONG retrieved;
hr = rangeTest->GetText(ec, 0, &buf[0], shifted, &retrieved);
hr = rangeTest->GetText(ec, 0, &buf[0], std::min(shifted, SWF_MAXCHARS), &retrieved);
HRESULT_CHECK_RETURN(hr, L"%s", L"rangeTest->GetText failed");

if (!retrieved) {
Expand Down

0 comments on commit 3773d22

Please sign in to comment.