File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments