format
This commit is contained in:
@@ -70,30 +70,6 @@ namespace BeWo.ViewModel.Controls.AI
|
||||
FirePropertyChanged(nameof(IsUndoButtonVisible));
|
||||
}
|
||||
|
||||
public void Accept(string str)
|
||||
{
|
||||
var idx = CurrentIndex;
|
||||
var count = History.Count;
|
||||
|
||||
var last_idx = count - 1;
|
||||
|
||||
if (last_idx > idx)
|
||||
{
|
||||
History.RemoveRange(idx + 1, last_idx - idx);
|
||||
}
|
||||
|
||||
if (CurrentValue != History[CurrentIndex])
|
||||
{
|
||||
History.Add(CurrentValue);
|
||||
CurrentIndex++;
|
||||
}
|
||||
|
||||
History.Add(str);
|
||||
CurrentIndex++;
|
||||
|
||||
CurrentValue = str;
|
||||
}
|
||||
|
||||
public void UndoAiAction()
|
||||
{
|
||||
if (CurrentIndex <= 0)
|
||||
@@ -124,12 +100,36 @@ namespace BeWo.ViewModel.Controls.AI
|
||||
|
||||
var str = sb.ToString();
|
||||
|
||||
Accept(str);
|
||||
accept(str);
|
||||
}
|
||||
|
||||
public void ReplaceValue(string str)
|
||||
{
|
||||
Accept(str);
|
||||
accept(str);
|
||||
}
|
||||
|
||||
private void accept(string str)
|
||||
{
|
||||
var idx = CurrentIndex;
|
||||
var count = History.Count;
|
||||
|
||||
var last_idx = count - 1;
|
||||
|
||||
if (last_idx > idx)
|
||||
{
|
||||
History.RemoveRange(idx + 1, last_idx - idx);
|
||||
}
|
||||
|
||||
if (CurrentValue != History[CurrentIndex])
|
||||
{
|
||||
History.Add(CurrentValue);
|
||||
CurrentIndex++;
|
||||
}
|
||||
|
||||
History.Add(str);
|
||||
CurrentIndex++;
|
||||
|
||||
CurrentValue = str;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user