public bool TrySaveToFile(string path) { var snapshot = _historyTextBuffer.CurrentSnapshot; var content = _entries.GetEntries().Select(e => e.Span.GetText(snapshot).Replace(BlockSeparator, LineSeparator)).ToArray(); try { _fileSystem.FileWriteAllLines(path, content); return(true); } catch (Exception) { // Failure to save .RHistory isn't critical return(false); } }
private void CloneFromMultiline(IRHistoryEntries existingEntries) { foreach (var existingEntry in existingEntries.GetEntries()) { var entriesGroup = AddSinglelineEntries(existingEntry.EntrySpan); foreach (var newEntry in entriesGroup) { newEntry.IsSelected = existingEntry.IsSelected; } } }
protected void CloneEntries(IRHistoryEntries existingEntries) { foreach (var existingEntry in existingEntries.GetEntries()) { var newEntry = AddEntry(existingEntry.EntrySpan, existingEntry.Span); newEntry.IsSelected = existingEntry.IsSelected; } }
private void CloneFromSingleline(IRHistoryEntries existingEntries) { foreach (var entrySpanGroup in existingEntries.GetEntries().GroupBy(e => e.EntrySpan)) { var newEntry = AddMultilineEntry(entrySpanGroup.Key); newEntry.IsSelected = entrySpanGroup.Any(e => e.IsSelected); } }