File tree 1 file changed +7
-37
lines changed
1 file changed +7
-37
lines changed Original file line number Diff line number Diff line change @@ -433,54 +433,24 @@ void CommandHistory::_Inc(Index& ind) const
433
433
434
434
std::wstring CommandHistory::Remove (const Index iDel)
435
435
{
436
- Index iFirst = 0 ;
437
- auto iLast = gsl::narrow<Index>(_commands.size () - 1 );
438
- auto iDisp = LastDisplayed;
439
-
440
- if (_commands.size () == 0 )
436
+ if (iDel < 0 || iDel >= GetNumberOfCommands ())
441
437
{
442
438
return {};
443
439
}
444
440
445
- if ((iDel < iFirst) || (iDel > iLast))
446
- {
447
- return {};
448
- }
441
+ const auto str = std::move (_commands.at (iDel));
442
+ _commands.erase (_commands.begin () + iDel);
449
443
450
- if (iDisp == iDel)
444
+ if (LastDisplayed == iDel)
451
445
{
452
446
LastDisplayed = -1 ;
453
447
}
454
-
455
- try
448
+ else if (LastDisplayed > iDel)
456
449
{
457
- const auto str = _commands.at (iDel);
458
-
459
- if (iDel < iLast)
460
- {
461
- _commands.erase (_commands.cbegin () + iDel);
462
- if ((iDisp > iDel) && (iDisp <= iLast))
463
- {
464
- _Dec (iDisp);
465
- }
466
- _Dec (iLast);
467
- }
468
- else if (iDel >= iFirst)
469
- {
470
- _commands.erase (_commands.cbegin () + iDel);
471
- if ((iDisp >= iFirst) && (iDisp < iDel))
472
- {
473
- _Inc (iDisp);
474
- }
475
- _Inc (iFirst);
476
- }
477
-
478
- LastDisplayed = iDisp;
479
- return str;
450
+ _Dec (LastDisplayed);
480
451
}
481
- CATCH_LOG ();
482
452
483
- return {} ;
453
+ return str ;
484
454
}
485
455
486
456
// Routine Description:
You can’t perform that action at this time.
0 commit comments