public static string merge_lines(string old_text, string new_text) { // note : we don't care about apply-to-existing-lines - we know it's the same amongst old/new filter row // what I care about is the colors (line color and merge color) bool apply_to_existing_lines = false; var old_row = new raw_filter_row(old_text); var new_row = new raw_filter_row(new_text); // old lines - not trimmed (so that we can insert them as they were - if needed); new lines -> trimmed var old_lines = old_row.lines_.Where(x => !filter_line.is_color_or_font_line(x) && !x.Trim().StartsWith("#") && x.Trim() != "").ToList(); var new_lines = new_row.lines_.Where(x => !filter_line.is_color_or_font_line(x) && !x.Trim().StartsWith("#") && x.Trim() != "").Select(x => x.Trim()).ToList(); foreach (string line in old_lines) { if (!new_lines.Contains(line.Trim())) { util.append_line(ref new_text, line); } } if (new_row.color_line == "" && old_row.color_line != "") { // preserve old color util.append_line(ref new_text, old_row.color_line); } if (new_row.match_color_line == "" && old_row.match_color_line != "") { util.append_line(ref new_text, old_row.match_color_line); } return(new_text); }
public void preserve_cache_copy(raw_filter_row from) { enabled_ = from.enabled; dimmed_ = from.dimmed; // 1.0.91+ this is very important - in case only the font has changed (the rest is the same), we don't want a full refresh // we will use the new font though font_.copy_from(from.font_); }
public raw_filter_row(raw_filter_row other) { items_ = other.items_.ToList(); lines_ = other.lines_.ToArray(); additions_ = other.additions.ToList(); unique_id_ = other.unique_id_; valid_ = other.valid_; enabled_ = other.enabled; font_ = font_info.default_font.copy(); update_font(); }
public raw_filter_row(raw_filter_row other) { items_ = other.items_.ToList(); lines_ = other.lines_.ToArray(); additions_ = other.additions.ToList(); apply_to_existing_lines = other.apply_to_existing_lines; unique_id_ = other.unique_id_; valid_ = other.valid_; enabled_ = other.enabled; dimmed_ = other.dimmed_; font_ = font_info.default_font_copy; update_font(); }
private void update_non_active_filter(int idx) { var lv = log_view_for_tab(idx); if (lv.is_filter_set) return; ui_context ctx = cur_context(); List<raw_filter_row> lvf = new List<raw_filter_row>(); foreach (ui_filter filt in ctx.views[idx].filters) { var row = new raw_filter_row(filt.text, filt.apply_to_existing_lines); row.enabled = filt.enabled; row.dimmed = filt.dimmed; if (row.is_valid) lvf.Add(row); } lv.set_filter(lvf); }
public filter_row(raw_filter_row other) : base(other) { }
// returns true if it's equal to the other row, regardless of being enabled or not // // if it is, we can keep the cached information (about line matches) public bool same(raw_filter_row other) { //return Enumerable.SequenceEqual(items_, other.items_) && Enumerable.SequenceEqual(additions_, other.additions_) && apply_to_existing_lines == other.apply_to_existing_lines; return(unique_id == other.unique_id && font_ == other.font_); }
protected bool Equals(raw_filter_row other) { return(same(other) && enabled == other.enabled); }
// returns true if it's equal to the other row, regardless of being enabled or not // // if it is, we can keep the cached information (about line matches) public bool same(raw_filter_row other) { //return Enumerable.SequenceEqual(items_, other.items_) && Enumerable.SequenceEqual(additions_, other.additions_) && apply_to_existing_lines == other.apply_to_existing_lines; return unique_id == other.unique_id && apply_to_existing_lines == other.apply_to_existing_lines && font_ == other.font_; }
protected bool Equals(raw_filter_row other) { return same(other) && (enabled == other.enabled) && (dimmed == other.dimmed); }
public void preserve_cache_copy(raw_filter_row from) { enabled_ = from.enabled; dimmed_ = from.dimmed; // 1.0.91+ this is very important - in case only the font has changed (the rest is the same), we don't want a full refresh // we will use the new font though font_.copy_from( from.font_); }
public static string merge_lines(string old_text, string new_text) { // note : we don't care about apply-to-existing-lines - we know it's the same amongst old/new filter row // what I care about is the colors (line color and merge color) bool apply_to_existing_lines = false; var old_row = new raw_filter_row(old_text, apply_to_existing_lines); var new_row = new raw_filter_row(new_text, apply_to_existing_lines); // old lines - not trimmed (so that we can insert them as they were - if needed); new lines -> trimmed var old_lines = old_row.lines_.Where(x => !filter_line.is_color_or_font_line(x) && !x.Trim().StartsWith("#") && x.Trim() != "" ).ToList(); var new_lines = new_row.lines_.Where(x => !filter_line.is_color_or_font_line(x) && !x.Trim().StartsWith("#") && x.Trim() != "" ).Select(x => x.Trim()).ToList(); foreach ( string line in old_lines) if ( !new_lines.Contains( line.Trim())) util.append_line(ref new_text, line); if (new_row.color_line == "" && old_row.color_line != "") // preserve old color util.append_line(ref new_text, old_row.color_line); if ( new_row.match_color_line == "" && old_row.match_color_line != "") util.append_line(ref new_text, old_row.match_color_line); return new_text; }