// reason for default = noop, later plan to add more options public void MarkTab(string contentId, bool?dirty = null) { if (!dirty.HasValue) { return; } Update(Utils.Update((EditorState s, JObject c) => { var tabs = s.Tabs; int index = -1; Tab tab = null; for (int i = 0, l = tabs.Count; i < l; i++) { tab = tabs[i]; if (tab.ContentId == contentId) { index = i; break; } } if (index == -1) { throw new Exception("tab not found"); } JObject tabChange = new JObject(); JObject tabListChanges = new JObject(); if (dirty.HasValue) { tab = tab.AsDirty(dirty.Value, tabChange); } Core.Utils.RegisterChange(tabListChanges, index.ToString(), tab, tabChange); return(s.WithTabs(tabs.SetItem(index, tab), c, tabListChanges)); })); }