Skip to content

Commit

Permalink
HistoryLister: bug fix; single undo action was undoing first two oper…
Browse files Browse the repository at this point in the history
…ations.
  • Loading branch information
abeckus committed Sep 4, 2014
1 parent 0bb0d34 commit 88cf9df
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions Framework/Atf.Gui.WinForms/Applications/Listers/HistoryLister.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ void IInitializable.Initialize()
{
try
{
if (m_udpatingIndex) return;
m_undoingOrRedoing = true;
int indexLastDone = m_commandHistory.Current - 1;
int cmdIndex = m_listbox.SelectedIndex + m_startIndex;
Expand Down Expand Up @@ -171,11 +172,19 @@ private void m_commandHistory_CommandDone(object sender, EventArgs e)
private void UpdatedSelectedIndex()
{
if (m_undoingOrRedoing) return;
m_listbox.BeginUpdate();
int selectedIndex = (m_commandHistory.Current - 1) - m_startIndex;
if (selectedIndex < -1) selectedIndex = -1;
m_listbox.SelectedIndex = selectedIndex;
m_listbox.EndUpdate();
try
{
m_udpatingIndex = true;
m_listbox.BeginUpdate();
int selectedIndex = (m_commandHistory.Current - 1) - m_startIndex;
if (selectedIndex < -1) selectedIndex = -1;
m_listbox.SelectedIndex = selectedIndex;
m_listbox.EndUpdate();
}
finally
{
m_udpatingIndex = false;
}
}
private void BuildList()
{
Expand Down Expand Up @@ -214,8 +223,8 @@ private void ComputeColors()

[Import(AllowDefault = true)]
private ISettingsService m_settingsService;


private bool m_udpatingIndex;
private int m_startIndex;
private int m_lastCmdCount; // last command count.
private CommandHistory m_commandHistory;
Expand Down

0 comments on commit 88cf9df

Please sign in to comment.