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)
2470
2470
if (strCurrent.IsEmpty ())
2471
2471
return ;
2472
2472
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
2475
2475
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
2478
2478
strFirst += strLast; // put last bit back
2479
2479
GetEditCtrl ().SetSel (0 , -1 ); // select all
2480
2480
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
2481
2484
2482
2485
return ;
2483
2486
}
You can’t perform that action at this time.
0 commit comments