Skip to content

Commit 15926e6

Browse files
committed
Fixed bug in way Ctrl+Backspace worked
1 parent 813c367 commit 15926e6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

sendvw.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,14 +2470,17 @@ if (pDoc->m_bCtrlBackspaceDeletesLastWord)
24702470
if (strCurrent.IsEmpty ())
24712471
return;
24722472

2473-
CString strLast = strCurrent.Mid (nStartChar); // after the selection
2474-
CString strFirst = strCurrent.Left (nStartChar); // up to the selection
2473+
CString strLast = strCurrent.Mid (nStartChar); // after the cursor
2474+
CString strFirst = strCurrent.Left (nStartChar); // up to the cursor
24752475
strFirst.TrimRight (); // skip trailing spaces
2476-
int iPos = strFirst.ReverseFind (' ');
2477-
strFirst = strFirst.Left (iPos + 1); // up to and including the space
2476+
int iPos = strFirst.ReverseFind (' '); // find the preceding space
2477+
strFirst = strFirst.Left (iPos); // up to the space
24782478
strFirst += strLast; // put last bit back
24792479
GetEditCtrl().SetSel (0, -1); // select all
24802480
GetEditCtrl().ReplaceSel (strFirst, TRUE);
2481+
if (iPos < 0) // if no space put cursor at start of line
2482+
iPos = 0;
2483+
GetEditCtrl().SetSel (iPos, iPos); // put cursor at end of preceding word
24812484

24822485
return;
24832486
}

0 commit comments

Comments
 (0)