search fixes

This commit is contained in:
tstack 2010-11-21 22:01:57 -08:00
parent a77dbe445c
commit fd7d59383b
5 changed files with 21 additions and 7 deletions

View File

@ -411,6 +411,10 @@ static void rebuild_indexes(bool force)
start_line = force ? grep_line_t(0) : grep_line_t(-1);
if (force) {
log_view.match_reset();
}
for (lpc = 0; lpc < LG__MAX; lpc++) {
if (lnav_data.ld_grep_child[lpc].get() != NULL) {
lnav_data.ld_grep_child[lpc]->get_grep_proc()->
@ -1661,6 +1665,7 @@ static void rl_search(void *dummy, readline_curses *rc)
fprintf(stderr, "start search for: %s\n", rc->get_value().c_str());
tc->set_top(lnav_data.ld_search_start_line);
tc->match_reset();
if (rc->get_value().empty()) {
lnav_data.ld_bottom_source.grep_error("");

View File

@ -138,6 +138,7 @@ int log_format::log_scanf(const char *line,
static const char *std_time_fmt[] = {
"%Y-%m-%d %H:%M:%S",
"%Y-%m-%d %H:%M",
"%Y-%m-%dT%H:%M:%S",
"%Y/%m/%d %H:%M:%S",
"%Y/%m/%d %H:%M",

View File

@ -174,12 +174,13 @@ class generic_log_format : public log_format {
char *prefix,
int len) {
static const char *log_fmt[] = {
"%63[a-zA-Z0-9: ,-] [%*[^]]]%15[^:]",
"%63[a-zA-Z0-9: ,-] %15s",
"[%63[0-9: .-] %*s %15s",
"[%63[a-zA-Z0-9: -]] %15s",
"[%63[a-zA-Z0-9: -]] [%15[a-zA-Z]]",
"[%63[a-zA-Z0-9: .-] %*s %15s",
"[%63[a-zA-Z0-9: -]] (%*d) %15s",
"[%63[a-zA-Z0-9: -+/]] %15s",
"[%63[a-zA-Z0-9: -+/]] [%15[a-zA-Z]]",
"[%63[a-zA-Z0-9: .-+/] %*s %15s",
"[%63[a-zA-Z0-9: -+/]] (%*d) %15s",
NULL
};

View File

@ -157,9 +157,11 @@ void textview_curses::reload_data(void)
void textview_curses::grep_begin(grep_proc &gp)
{
this->tc_searching = true;
this->tc_match_count = 0;
this->tc_bookmarks[&BM_SEARCH].clear();
if (0) {
this->tc_match_count = 0;
this->tc_bookmarks[&BM_SEARCH].clear();
}
this->tc_search_action.invoke(this);
listview_curses::reload_data();

View File

@ -250,6 +250,11 @@ public:
return this->tc_match_count;
};
void match_reset() {
this->tc_match_count = 0;
this->tc_bookmarks[&BM_SEARCH].clear();
}
typedef std::map<std::string, highlighter> highlight_map_t;
highlight_map_t &get_highlights() { return this->tc_highlights; };