public void Back_HasItemsTest()
{
var history = new StatusTextHistory();
- history.SetLastItem("@hoge aaa", (new TwitterStatusId("111"), "hoge"));
- history.AddLast();
+ history.AddLast("@hoge aaa", (new TwitterStatusId("111"), "hoge"));
history.Back("@foo bbb", (new TwitterStatusId("222"), "foo"));
Assert.Equal(2, history.Items.Count);
public void Forward_HasItemsTest()
{
var history = new StatusTextHistory();
- history.SetLastItem("@hoge aaa", (new TwitterStatusId("111"), "hoge"));
- history.AddLast();
+ history.AddLast("@hoge aaa", (new TwitterStatusId("111"), "hoge"));
history.Back("@foo bbb", (new TwitterStatusId("222"), "foo"));
history.Forward("@hoge aaa 123", (new TwitterStatusId("111"), "hoge"));
public void AddLast_Test()
{
var history = new StatusTextHistory();
- history.SetLastItem("@hoge aaa", (new TwitterStatusId("111"), "hoge"));
- history.AddLast();
+ history.AddLast("@hoge aaa", (new TwitterStatusId("111"), "hoge"));
Assert.Equal(2, history.Items.Count);
Assert.Equal(new("@hoge aaa", (new TwitterStatusId("111"), "hoge")), history.Items[0]);
Assert.Equal(new("", null), history.Items[1]);
public void Peek_HasItemsTest()
{
var history = new StatusTextHistory();
- history.SetLastItem("@hoge aaa", (new TwitterStatusId("111"), "hoge"));
- history.AddLast();
+ history.AddLast("@hoge aaa", (new TwitterStatusId("111"), "hoge"));
Assert.Equal(new("@hoge aaa", (new TwitterStatusId("111"), "hoge")), history.Peek());
}
return this.items[this.historyIndex];
}
- public void SetLastItem(string text, (PostId StatusId, string ScreenName)? inReplyTo)
- => this.items[this.items.Count - 1] = new(text, inReplyTo);
-
- public void AddLast()
+ public void AddLast(string text, (PostId StatusId, string ScreenName)? inReplyTo)
{
+ this.items[this.items.Count - 1] = new(text, inReplyTo);
+
this.items.Add(new(""));
this.historyIndex = this.items.Count - 1;
}
return;
}
- this.history.SetLastItem(this.StatusText.Text, this.inReplyTo);
-
if (this.settings.Common.Nicoms)
{
this.StatusText.SelectionStart = this.StatusText.Text.Length;
uploadService = this.ImageSelector.Model.GetService(serviceName);
}
+ this.history.AddLast(this.StatusText.Text, this.inReplyTo);
+
this.inReplyTo = null;
this.StatusText.Text = "";
- this.history.AddLast();
if (!this.settings.Common.FocusLockToStatusText)
this.CurrentListView.Focus();
this.urlUndoBuffer = null;