Skip to content

Commit

Permalink
1.6.6g
Browse files Browse the repository at this point in the history
- #9 - bug: type as you go + if searching works for something, but it's
only visible in the description pane, i will show that by showing all
line in the view in a
slightly different background (so that the user sees his search is
successful)
  • Loading branch information
jtorjo committed Jan 6, 2016
1 parent a7e9d19 commit b80e4c7
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 18 deletions.
16 changes: 6 additions & 10 deletions src/docs/history.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@

#9 - bug: type as you go
If type-as-yo-go searching for something that is only in description pane -> when I type something only valid in description pane, the list view does not update.
Such as, going from "o" to "oc" -> at this point, the list view should show nothing selected, as there is nothing with "oc" in the list (only in description pane)

Search next/prev -> does not work when something is only found in description pane

IMPORTANT: if searching works for something, but it's only visible in the description pane, i will show that by showing all line in the view in a
slightly different background (so that the user sees his search is successful)

#13 - bug: if at the last last visible down + arrow down



Expand All @@ -19,7 +11,6 @@ slightly different background (so that the user sees his search is successful)
- it's weird - sometimes works sometimes not -> seems ot always work only on the view that originally had focus, but not on the others
-- "hotkeys" tab always seems to be marked as "has new items" even if i traverse it

#13 - bug: if at the last last visible down + arrow down



Expand All @@ -44,6 +35,11 @@ slightly different background (so that the user sees his search is successful)
https://news.ycombinator.com/news
quora

1.6.6g
- #9 - bug: type as you go + if searching works for something, but it's only visible in the description pane, i will show that by showing all line in the view in a
slightly different background (so that the user sees his search is successful)


1.6.6f
- if current col not visible, update the smart edit so that it points somewhere

Expand Down
2 changes: 2 additions & 0 deletions src/docs/todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
- explain about editing Description pane , etc.
-- tidbits : about finding (what gets selected), about Description control, about copying records from event viewer
- ask about what people would want in such a logviewer
- find: about the fact that if searching for something, if not in the columns in View, is shown as slightly darker
- find: allow searching in all columns



Expand Down
5 changes: 3 additions & 2 deletions src/lw_common/settings/app.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ public enum edit_mode_type {
// if true, when the user types something, and we can't find the word ahead, search before as well
public bool edit_search_before = true;
// if true, when searching something, search all columns (current column first!)
public bool edit_search_all_columns = false;
// 1.6.6 - made the default to true
public bool edit_search_all_columns = true;
// if true, clicking a word selects it
public bool edit_click_word_selects_it = true;

Expand Down Expand Up @@ -379,7 +380,7 @@ public enum edit_mode_type {

load_save(load, ref edit_search_after, "edit_search_after", true);
load_save(load, ref edit_search_before, "edit_search_before", true);
load_save(load, ref edit_search_all_columns, "edit_search_all_columns", false);
load_save(load, ref edit_search_all_columns, "edit_search_all_columns", true);

load_save(load, ref show_filter_row_in_filter_color, "show_filter_row_in_filter_color", true);

Expand Down
35 changes: 29 additions & 6 deletions src/lw_common/ui/log_view/log_view.cs
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,10 @@ public log_view(Form parent, string name)
}
}

internal int cur_col_idx {
get { return cur_col_; }
}

public List<int> multi_sel_idx {
get {
List<int> sel = new List<int>();
Expand Down Expand Up @@ -1585,6 +1589,25 @@ public enum select_type {
search_for_text_next();
}

private bool row_contains_search_text(int row_idx, List<int> visible_indexes) {
string sel_text = edit.sel_text.ToLower();
Debug.Assert(sel_text != "");


if (app.inst.edit_search_all_columns) {
foreach (var col in visible_indexes)
if (can_find_text_at_row(sel_text, row_idx, col))
return true;
} else if (can_find_text_at_row(sel_text, row_idx, cur_col_))
return true;

return false;
}

internal bool is_searching() {
return (cur_search_ != null || edit.sel_text != "");
}

private void search_for_text_next() {
int count = item_count;
if (count < 1)
Expand All @@ -1595,13 +1618,13 @@ public enum select_type {
if (cur_search_ == null && sel_text == "")
return;

var all_visible_column_indexes = all_visible_column_types().Select(log_view_cell.info_type_to_cell_idx).ToList();
int found = -1;
int next_row = sel_row_idx >= 0 ? sel_row_idx + 1 : 0;
for (int idx = next_row; idx < count && found < 0; ++idx) {
// 1.2.7+ - if user has selected something, search for that
if (sel_text != "") {
string cur = list.GetItem(idx).GetSubItem( visible_column(cur_col_)).Text;
if (cur.ToLower().Contains(sel_text))
if ( row_contains_search_text(idx, all_visible_column_indexes))
found = idx;
continue;
}
Expand All @@ -1627,13 +1650,13 @@ public enum select_type {
if (cur_search_ == null && sel_text == "")
return;

var all_visible_column_indexes = all_visible_column_types().Select(log_view_cell.info_type_to_cell_idx).ToList();
int found = -1;
int prev_row = sel_row_idx >= 0 ? sel_row_idx - 1 : count - 1;
for (int idx = prev_row; idx >= 0 && found < 0; --idx) {
// 1.2.7+ - if user has selected something, search for that
if (sel_text != "") {
string cur = list.GetItem(idx).GetSubItem( visible_column(cur_col_)).Text;
if (cur.ToLower().Contains(sel_text))
if ( row_contains_search_text(idx, all_visible_column_indexes))
found = idx;
continue;
}
Expand Down Expand Up @@ -2116,7 +2139,7 @@ public enum select_type {
}

// returns all visible column types - including those from the description control
private List<info_type> all_visible_column_types() {
internal List<info_type> all_visible_column_types() {
List<info_type> visible = lv_parent.description_columns();

for (int col_idx = 0; col_idx < list.AllColumns.Count; ++col_idx)
Expand All @@ -2128,7 +2151,7 @@ public enum select_type {

return visible;
}
private List<info_type> view_visible_column_types() {
internal List<info_type> view_visible_column_types() {
List<info_type> visible = new List<info_type>();

for (int col_idx = 0; col_idx < list.AllColumns.Count; ++col_idx)
Expand Down
3 changes: 3 additions & 0 deletions src/lw_common/ui/log_view/log_view_cell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ internal class log_view_cell {
case info_type.file: return i.file;
case info_type.func: return i.func;

case info_type.line: return "" + i.line;
case info_type.view: return i.view;

case info_type.ctx1: return i.ctx1;
case info_type.ctx2: return i.ctx2;
case info_type.ctx3: return i.ctx3;
Expand Down
39 changes: 39 additions & 0 deletions src/lw_common/ui/log_view/match/match_item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,50 @@ internal class match_item : filter.match {
else
result = font.bg;

// 1.6.6 - if user has searched for something only visible in description pane, show it a bit darker, so the user knows it's a match on this line
if (result == util.transparent)
if (parent.is_searching()) {
var view_visible = parent.view_visible_column_types();
bool search_matches_view = search_matches_any_column(parent, view_visible);
if (!search_matches_view) {
var all_visible = parent.all_visible_column_types();
var details_visible = all_visible.Where( x => !view_visible.Contains(x) ).ToList();
if (search_matches_any_column(parent, details_visible))
result = search_form_history.inst.default_search.bg;
}
}


if (result == util.transparent)
result = app.inst.bg;
return result;
}

private bool search_matches_any_column(log_view parent, List<info_type> columns) {
string sel_text = parent.edit.sel_text.ToLower();
var cur_col = log_view_cell.cell_idx_to_type(parent.cur_col_idx);
if (sel_text != "") {
if (app.inst.edit_search_all_columns) {
foreach (info_type col in columns) {
string txt = log_view_cell.cell_value_by_type(this, col).ToLower();
if (txt.Contains(sel_text))
return true;
}
} else if (columns.Contains(cur_col)) {
string txt = log_view_cell.cell_value_by_type(this, cur_col).ToLower();
if (txt.Contains(sel_text))
return true;
}
} else {
// search for cur_search
if (columns.Contains(info_type.msg)) {
if (string_search.matches(this.match.line.part(info_type.msg), parent.cur_search))
return true;
}
}
return false;
}

private List<Tuple<int, int, print_info>> override_print_from_all_places(log_view parent, string text, int col_idx) {
List<Tuple<int, int, print_info>> print = new List<Tuple<int, int, print_info>>();

Expand Down

0 comments on commit b80e4c7

Please sign in to comment.