mirror of
https://github.com/tstack/lnav
synced 2024-11-01 21:40:34 +00:00
[hotkey/status] use 9/( as spatial hotkeys and tweak the status lines
This commit is contained in:
parent
84dad8e2e9
commit
c54c2dd508
@ -36,6 +36,11 @@
|
||||
|
||||
#include "view_curses.hh"
|
||||
|
||||
#define ANSI_BOLD_START "\x1b[1m"
|
||||
#define ANSI_NORM "\x1b[0m"
|
||||
|
||||
#define ANSI_BOLD(msg) ANSI_BOLD_START msg ANSI_NORM
|
||||
|
||||
/**
|
||||
* Check a string for ANSI escape sequences, process them, remove them, and add
|
||||
* any style attributes to the given attribute container.
|
||||
|
@ -180,10 +180,8 @@ public:
|
||||
if (bm.find(&logfile_sub_source::BM_WARNINGS) != bm.end()) {
|
||||
bookmark_vector<vis_line_t> &bv =
|
||||
bm[&logfile_sub_source::BM_WARNINGS];
|
||||
bookmark_vector<vis_line_t>::iterator iter;
|
||||
|
||||
iter = lower_bound(bv.begin(), bv.end(), tc->get_top() + height);
|
||||
sfw.set_value("%'9dW", distance(iter, bv.end()));
|
||||
sfw.set_value("%'9dW", bv.size());
|
||||
}
|
||||
else {
|
||||
sfw.clear();
|
||||
@ -192,10 +190,8 @@ public:
|
||||
if (bm.find(&logfile_sub_source::BM_ERRORS) != bm.end()) {
|
||||
bookmark_vector<vis_line_t> &bv =
|
||||
bm[&logfile_sub_source::BM_ERRORS];
|
||||
bookmark_vector<vis_line_t>::iterator iter;
|
||||
|
||||
iter = lower_bound(bv.begin(), bv.end(), tc->get_top() + height);
|
||||
sfe.set_value("%'9dE", distance(iter, bv.end()));
|
||||
sfe.set_value("%'9dE", bv.size());
|
||||
}
|
||||
else {
|
||||
sfe.clear();
|
||||
|
134
src/lnav.cc
134
src/lnav.cc
@ -75,6 +75,7 @@
|
||||
#include "init-sql.hh"
|
||||
#include "logfile.hh"
|
||||
#include "lnav_util.hh"
|
||||
#include "ansi_scrubber.hh"
|
||||
#include "listview_curses.hh"
|
||||
#include "statusview_curses.hh"
|
||||
#include "vt52_curses.hh"
|
||||
@ -106,6 +107,12 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define HELP_MSG_1(x, msg) \
|
||||
"Press '" ANSI_BOLD(#x) "'' " msg
|
||||
|
||||
#define HELP_MSG_2(x, y, msg) \
|
||||
"Press " ANSI_BOLD(#x) "/" ANSI_BOLD(#y) " " msg
|
||||
|
||||
static multimap<lnav_flags_t, string> DEFAULT_FILES;
|
||||
|
||||
struct _lnav_data lnav_data;
|
||||
@ -758,6 +765,28 @@ static void back_ten(int ten_minute)
|
||||
lnav_data.ld_view_stack.top()->set_top(line);
|
||||
}
|
||||
|
||||
static void update_view_name(void)
|
||||
{
|
||||
static const char *view_names[LNV__MAX] = {
|
||||
"LOG",
|
||||
"TEXT",
|
||||
"HELP",
|
||||
"HIST",
|
||||
"GRAPH",
|
||||
"DB",
|
||||
"EXAMPLE",
|
||||
};
|
||||
|
||||
status_field &sf = lnav_data.ld_top_source.statusview_value_for_field(
|
||||
top_status_source::TSF_VIEW_NAME);
|
||||
textview_curses *tc = lnav_data.ld_view_stack.top();
|
||||
struct line_range lr = { 0, 1 };
|
||||
|
||||
sf.set_value("< % 5s", view_names[tc - lnav_data.ld_views]);
|
||||
sf.get_value().get_attrs()[lr].insert(make_string_attr(
|
||||
"style", A_BOLD|COLOR_PAIR(view_colors::VC_GREEN_ON_WHITE)));
|
||||
}
|
||||
|
||||
bool toggle_view(textview_curses *toggle_tc)
|
||||
{
|
||||
textview_curses *tc = lnav_data.ld_view_stack.top();
|
||||
@ -774,6 +803,8 @@ bool toggle_view(textview_curses *toggle_tc)
|
||||
tc->set_needs_update();
|
||||
lnav_data.ld_scroll_broadcaster.invoke(tc);
|
||||
|
||||
update_view_name();
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -927,16 +958,16 @@ static void handle_paging_key(int ch)
|
||||
string msg = "";
|
||||
|
||||
if (tc == &lnav_data.ld_views[LNV_DB]) {
|
||||
msg = "v/V: Switch to the SQL result view";
|
||||
msg = HELP_MSG_2(v, V, "to switch to the SQL result view");
|
||||
}
|
||||
else if (tc == &lnav_data.ld_views[LNV_HISTOGRAM]) {
|
||||
msg = "i/I: Switch to the histogram view";
|
||||
msg = HELP_MSG_2(i, I, "to switch to the histogram view");
|
||||
}
|
||||
else if (tc == &lnav_data.ld_views[LNV_TEXT]) {
|
||||
msg = "t: Switch to the text file view";
|
||||
msg = HELP_MSG_1(t, "to switch to the text file view");
|
||||
}
|
||||
else if (tc == &lnav_data.ld_views[LNV_GRAPH]) {
|
||||
msg = "g: Switch to the graph view";
|
||||
msg = HELP_MSG_1(g, "to switch to the graph view");
|
||||
}
|
||||
|
||||
lnav_data.ld_rl_view->set_alt_value(msg);
|
||||
@ -952,6 +983,7 @@ static void handle_paging_key(int ch)
|
||||
tc = lnav_data.ld_view_stack.top();
|
||||
tc->set_needs_update();
|
||||
lnav_data.ld_scroll_broadcaster.invoke(tc);
|
||||
update_view_name();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -970,44 +1002,46 @@ static void handle_paging_key(int ch)
|
||||
moveto_cluster(&bookmark_vector<vis_line_t>::next,
|
||||
&logfile_sub_source::BM_ERRORS,
|
||||
tc->get_top());
|
||||
lnav_data.ld_rl_view->set_alt_value(
|
||||
"w/W: Move forward/backward through warning messages");
|
||||
lnav_data.ld_rl_view->set_alt_value(HELP_MSG_2(
|
||||
w, W, "to move forward/backward through warning messages"));
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
moveto_cluster(&bookmark_vector<vis_line_t>::prev,
|
||||
&logfile_sub_source::BM_ERRORS,
|
||||
tc->get_top());
|
||||
lnav_data.ld_rl_view->set_alt_value(
|
||||
"w/W: Move forward/backward through warning messages");
|
||||
lnav_data.ld_rl_view->set_alt_value(HELP_MSG_2(
|
||||
w, W, "to move forward/backward through warning messages"));
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
moveto_cluster(&bookmark_vector<vis_line_t>::next,
|
||||
&logfile_sub_source::BM_WARNINGS,
|
||||
tc->get_top());
|
||||
lnav_data.ld_rl_view->set_alt_value(
|
||||
"o/O: Move forward/backward an hour");
|
||||
lnav_data.ld_rl_view->set_alt_value(HELP_MSG_2(
|
||||
o, O, "to move forward/backward an hour"));
|
||||
break;
|
||||
|
||||
case 'W':
|
||||
moveto_cluster(&bookmark_vector<vis_line_t>::prev,
|
||||
&logfile_sub_source::BM_WARNINGS,
|
||||
tc->get_top());
|
||||
lnav_data.ld_rl_view->set_alt_value(
|
||||
"o/O: Move forward/backward an hour");
|
||||
lnav_data.ld_rl_view->set_alt_value(HELP_MSG_2(
|
||||
o, O, "to move forward/backward an hour"));
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
tc->set_top(bm[&textview_curses::BM_SEARCH].next(tc->get_top()));
|
||||
lnav_data.ld_rl_view->set_alt_value(
|
||||
"Press '>' or '<' to scroll horizontally to a search result");
|
||||
"Press '" ANSI_BOLD(">") "' or '" ANSI_BOLD("<")
|
||||
"' to scroll horizontally to a search result");
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
tc->set_top(bm[&textview_curses::BM_SEARCH].prev(tc->get_top()));
|
||||
lnav_data.ld_rl_view->set_alt_value(
|
||||
"Press '>' or '<' to scroll horizontally to a search result");
|
||||
"Press '" ANSI_BOLD(">") "' or '" ANSI_BOLD("<")
|
||||
"' to scroll horizontally to a search result");
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
@ -1097,8 +1131,8 @@ static void handle_paging_key(int ch)
|
||||
rebuild_hist(0, true);
|
||||
}
|
||||
|
||||
lnav_data.ld_rl_view->set_alt_value(
|
||||
"Press 'I' to switch to the log view at the top displayed time");
|
||||
lnav_data.ld_rl_view->set_alt_value(HELP_MSG_1(
|
||||
I, "to switch to the log view at the top displayed time"));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1112,8 +1146,8 @@ static void handle_paging_key(int ch)
|
||||
rebuild_hist(0, true);
|
||||
}
|
||||
|
||||
lnav_data.ld_rl_view->set_alt_value(
|
||||
"Press 'I' to switch to the log view at the top displayed time");
|
||||
lnav_data.ld_rl_view->set_alt_value(HELP_MSG_1(
|
||||
I, "to switch to the log view at the top displayed time"));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1165,8 +1199,8 @@ static void handle_paging_key(int ch)
|
||||
vis_line_t(lnav_data.ld_last_user_mark[tc]));
|
||||
tc->reload_data();
|
||||
|
||||
lnav_data.ld_rl_view->set_alt_value(
|
||||
"c: Copy marked lines to the clipboard");
|
||||
lnav_data.ld_rl_view->set_alt_value(HELP_MSG_1(
|
||||
c, "to copy marked lines to the clipboard"));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1198,8 +1232,8 @@ static void handle_paging_key(int ch)
|
||||
}
|
||||
tc->reload_data();
|
||||
|
||||
lnav_data.ld_rl_view->set_alt_value(
|
||||
"c: Copy marked lines to the clipboard");
|
||||
lnav_data.ld_rl_view->set_alt_value(HELP_MSG_1(
|
||||
c, "to copy marked lines to the clipboard"));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1281,6 +1315,22 @@ static void handle_paging_key(int ch)
|
||||
back_ten(6);
|
||||
break;
|
||||
|
||||
case '9':
|
||||
if (lss) {
|
||||
double tenth = ((double)tc->get_inner_height()) / 10.0;
|
||||
|
||||
tc->shift_top(vis_line_t(tenth));
|
||||
}
|
||||
break;
|
||||
|
||||
case '(':
|
||||
if (lss) {
|
||||
double tenth = ((double)tc->get_inner_height()) / 10.0;
|
||||
|
||||
tc->shift_top(vis_line_t(-tenth));
|
||||
}
|
||||
break;
|
||||
|
||||
case '0':
|
||||
if (lss) {
|
||||
time_t first_time = lnav_data.ld_top_time;
|
||||
@ -1420,8 +1470,8 @@ static void handle_paging_key(int ch)
|
||||
|
||||
case 't':
|
||||
if (toggle_view(&lnav_data.ld_views[LNV_TEXT])) {
|
||||
lnav_data.ld_rl_view->set_alt_value(
|
||||
"f/F: Switch to the next/previous file");
|
||||
lnav_data.ld_rl_view->set_alt_value(HELP_MSG_2(
|
||||
f, F, "to switch to the next/previous file"));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1432,7 +1482,8 @@ static void handle_paging_key(int ch)
|
||||
|
||||
case 'i':
|
||||
if (toggle_view(&lnav_data.ld_views[LNV_HISTOGRAM])) {
|
||||
lnav_data.ld_rl_view->set_alt_value("z/Z: Zoom in/out");
|
||||
lnav_data.ld_rl_view->set_alt_value(
|
||||
HELP_MSG_2(z, Z, "to zoom in/out"));
|
||||
}
|
||||
else {
|
||||
lnav_data.ld_rl_view->set_alt_value("");
|
||||
@ -1576,8 +1627,8 @@ static void handle_paging_key(int ch)
|
||||
case KEY_CTRL_R:
|
||||
reset_session();
|
||||
rebuild_indexes(true);
|
||||
lnav_data.ld_rl_view->set_alt_value(
|
||||
"r/R: Restore the next/previous session");
|
||||
lnav_data.ld_rl_view->set_alt_value(HELP_MSG_2(
|
||||
r, R, "to restore the next/previous session"));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1849,8 +1900,8 @@ static void rl_callback(void *dummy, readline_curses *rc)
|
||||
lnav_data.ld_rl_view->
|
||||
add_possibility(LNM_COMMAND, "filter", rc->get_value());
|
||||
rc->set_value("search: " + rc->get_value());
|
||||
rc->set_alt_value("n/N: Move forward/backward through search "
|
||||
"results");
|
||||
rc->set_alt_value(HELP_MSG_2(
|
||||
n, N, "to move forward/backward through search results"));
|
||||
}
|
||||
lnav_data.ld_mode = LNM_PAGING;
|
||||
break;
|
||||
@ -1925,8 +1976,9 @@ static void rl_callback(void *dummy, readline_curses *rc)
|
||||
"%'d row(s) matched",
|
||||
(int)dls.dls_rows.size());
|
||||
rc->set_value(row_count);
|
||||
rc->set_alt_value("y/Y: Move forward/backward through "
|
||||
"query results in the log view");
|
||||
rc->set_alt_value(HELP_MSG_2(
|
||||
y, Y, "to move forward/backward through query results "
|
||||
"in the log view"));
|
||||
}
|
||||
else {
|
||||
rc->set_value("No rows matched");
|
||||
@ -2452,11 +2504,13 @@ static void looper(void)
|
||||
rlc.set_y(-1);
|
||||
rlc.set_perform_action(readline_curses::action(rl_callback));
|
||||
rlc.set_timeout_action(readline_curses::action(rl_search));
|
||||
rlc.set_alt_value("e/E: Move forward/backward through error messages");
|
||||
rlc.set_alt_value(HELP_MSG_2(
|
||||
e, E, "to move forward/backward through error messages"));
|
||||
|
||||
(void)curs_set(0);
|
||||
|
||||
lnav_data.ld_view_stack.push(&lnav_data.ld_views[LNV_LOG]);
|
||||
update_view_name();
|
||||
|
||||
tc = lnav_data.ld_view_stack.top();
|
||||
|
||||
@ -2480,7 +2534,6 @@ static void looper(void)
|
||||
lnav_data.ld_status[LNS_BOTTOM].
|
||||
set_data_source(&lnav_data.ld_bottom_source);
|
||||
sb.push_back(view_action<listview_curses>(update_times));
|
||||
sb.push_back(&lnav_data.ld_top_source.marks_wire);
|
||||
sb.push_back(&lnav_data.ld_top_source.filename_wire);
|
||||
sb.push_back(&lnav_data.ld_bottom_source.line_number_wire);
|
||||
sb.push_back(&lnav_data.ld_bottom_source.percent_wire);
|
||||
@ -2554,16 +2607,13 @@ static void looper(void)
|
||||
if (!session_loaded && lnav_data.ld_views[LNV_LOG].get_inner_height() > 0) {
|
||||
load_session();
|
||||
if (!lnav_data.ld_session_file_names.empty()) {
|
||||
std::list<session_pair_t>::iterator sess_iter;
|
||||
std::string ago;
|
||||
|
||||
sess_iter = lnav_data.ld_session_file_names.begin();
|
||||
advance(sess_iter, lnav_data.ld_session_file_index);
|
||||
ago = time_ago(sess_iter->first.second);
|
||||
|
||||
lnav_data.ld_rl_view->set_value("restored session from " +
|
||||
ago +
|
||||
"; press Ctrl-R to reset session");
|
||||
ago = time_ago(lnav_data.ld_session_save_time);
|
||||
lnav_data.ld_rl_view->set_value(
|
||||
("restored session from " ANSI_BOLD_START) +
|
||||
ago +
|
||||
(ANSI_NORM "; press Ctrl-R to reset session"));
|
||||
}
|
||||
rebuild_indexes(true);
|
||||
session_loaded = true;
|
||||
@ -2606,7 +2656,7 @@ static void looper(void)
|
||||
toggle_view(&lnav_data.ld_views[LNV_TEXT]);
|
||||
lnav_data.ld_views[LNV_TEXT].set_top(vis_line_t(0));
|
||||
lnav_data.ld_rl_view->set_alt_value(
|
||||
"f/F: Switch to the next/previous file");
|
||||
HELP_MSG_2(f, F, "to switch to the next/previous file"));
|
||||
}
|
||||
initial_build = true;
|
||||
}
|
||||
|
@ -123,6 +123,7 @@ typedef std::pair<ppid_time_pair_t, std::string> session_pair_t;
|
||||
struct _lnav_data {
|
||||
std::string ld_session_id;
|
||||
time_t ld_session_time;
|
||||
time_t ld_session_save_time;
|
||||
std::list<session_pair_t> ld_session_file_names;
|
||||
int ld_session_file_index;
|
||||
const char * ld_program_name;
|
||||
|
@ -80,7 +80,7 @@ static string declare_table_statement(log_vtab_impl *vi)
|
||||
"BINARY" : iter->vc_collator);
|
||||
oss << coldecl;
|
||||
}
|
||||
oss << " log_path text collate naturalnocase,\n"
|
||||
oss << " log_path text hidden collate naturalnocase,\n"
|
||||
<< " log_text text hidden\n"
|
||||
<< ");";
|
||||
|
||||
|
@ -56,6 +56,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "auto_mem.hh"
|
||||
#include "ansi_scrubber.hh"
|
||||
#include "readline_curses.hh"
|
||||
|
||||
using namespace std;
|
||||
@ -630,18 +631,38 @@ void readline_curses::clear_possibilities(int context, string type)
|
||||
void readline_curses::do_update(void)
|
||||
{
|
||||
if (this->rc_active_context == -1) {
|
||||
int alt_start = getmaxx(this->vc_window) - this->rc_alt_value.length();
|
||||
int alt_start = -1;
|
||||
struct line_range lr = { 0, };
|
||||
attr_line_t al, alt_al;
|
||||
|
||||
wmove(this->vc_window, this->get_actual_y(), 0);
|
||||
wclrtoeol(this->vc_window);
|
||||
if (alt_start >= (int)(this->rc_value.length() + 5)) {
|
||||
mvwprintw(this->vc_window, this->get_actual_y(), alt_start,
|
||||
"%s",
|
||||
this->rc_alt_value.c_str());
|
||||
|
||||
al.get_string() = this->rc_value;
|
||||
scrub_ansi_string(al.get_string(), al.get_attrs());
|
||||
|
||||
if (!this->rc_alt_value.empty()) {
|
||||
alt_al.get_string() = this->rc_alt_value;
|
||||
scrub_ansi_string(alt_al.get_string(), alt_al.get_attrs());
|
||||
|
||||
alt_start = getmaxx(this->vc_window) - alt_al.get_string().size();
|
||||
}
|
||||
mvwprintw(this->vc_window, this->get_actual_y(), 0,
|
||||
"%s",
|
||||
this->rc_value.c_str());
|
||||
|
||||
if (alt_start >= (int)(al.get_string().length() + 5)) {
|
||||
lr.lr_end = alt_al.get_string().length();
|
||||
view_curses::mvwattrline(this->vc_window,
|
||||
this->get_actual_y(),
|
||||
alt_start,
|
||||
alt_al,
|
||||
lr);
|
||||
}
|
||||
|
||||
lr.lr_end = al.get_string().length();
|
||||
view_curses::mvwattrline(this->vc_window,
|
||||
this->get_actual_y(),
|
||||
0,
|
||||
al,
|
||||
lr);
|
||||
this->set_x(0);
|
||||
}
|
||||
vt52_curses::do_update();
|
||||
|
@ -364,6 +364,13 @@ void load_bookmarks(void)
|
||||
}
|
||||
}
|
||||
|
||||
static int save_time(void *ctx, long long value)
|
||||
{
|
||||
lnav_data.ld_session_save_time = value;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int read_files(void *ctx, const unsigned char *str, size_t len)
|
||||
{
|
||||
return 1;
|
||||
@ -399,6 +406,7 @@ static int read_commands(void *ctx, const unsigned char *str, size_t len)
|
||||
}
|
||||
|
||||
static struct json_path_handler view_info_handlers[] = {
|
||||
json_path_handler("/save-time", save_time),
|
||||
json_path_handler("/files#", read_files),
|
||||
json_path_handler("/views/([^.]+)/top_line", read_top_line),
|
||||
json_path_handler("/commands#", read_commands),
|
||||
@ -422,6 +430,7 @@ void load_session(void)
|
||||
handle = yajl_alloc(&ypc.ypc_callbacks, NULL, &ypc);
|
||||
sess_iter = lnav_data.ld_session_file_names.begin();
|
||||
advance(sess_iter, lnav_data.ld_session_file_index);
|
||||
lnav_data.ld_session_save_time = sess_iter->first.second;
|
||||
string &view_info_name = sess_iter->second;
|
||||
|
||||
if ((fd = open(view_info_name.c_str(), O_RDONLY)) < 0) {
|
||||
@ -572,6 +581,9 @@ void save_session(void)
|
||||
{
|
||||
yajlpp_map root_map(handle);
|
||||
|
||||
root_map.gen("save-time");
|
||||
root_map.gen(time(NULL));
|
||||
|
||||
root_map.gen("files");
|
||||
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ void statusview_curses::do_update(void)
|
||||
|
||||
getmaxyx(this->sc_window, height, width);
|
||||
top = this->sc_top < 0 ? height + this->sc_top : this->sc_top;
|
||||
right = width - 2;
|
||||
right = width - 1;
|
||||
attrs = vc.attrs_for_role(view_colors::VCR_STATUS);
|
||||
|
||||
wattron(this->sc_window, attrs);
|
||||
@ -63,8 +63,9 @@ void statusview_curses::do_update(void)
|
||||
val = sf.get_value();
|
||||
|
||||
if (sf.is_right_justified()) {
|
||||
right -= 1 + sf.get_width();
|
||||
right -= sf.get_width();
|
||||
x = right;
|
||||
right -= 1;
|
||||
}
|
||||
else {
|
||||
x = left;
|
||||
|
@ -46,8 +46,7 @@ public:
|
||||
|
||||
typedef enum {
|
||||
TSF_TIME,
|
||||
TSF_WARNINGS,
|
||||
TSF_ERRORS,
|
||||
TSF_VIEW_NAME,
|
||||
TSF_FORMAT,
|
||||
TSF_FILENAME,
|
||||
|
||||
@ -55,13 +54,11 @@ public:
|
||||
} field_t;
|
||||
|
||||
top_status_source()
|
||||
: marks_wire(*this, &top_status_source::update_marks),
|
||||
filename_wire(*this, &top_status_source::update_filename)
|
||||
: filename_wire(*this, &top_status_source::update_filename)
|
||||
{
|
||||
this->tss_fields[TSF_TIME].set_width(24);
|
||||
this->tss_fields[TSF_WARNINGS].set_width(10);
|
||||
this->tss_fields[TSF_ERRORS].set_width(10);
|
||||
this->tss_fields[TSF_ERRORS].set_role(view_colors::VCR_ALERT_STATUS);
|
||||
this->tss_fields[TSF_VIEW_NAME].set_width(7);
|
||||
this->tss_fields[TSF_VIEW_NAME].right_justify(true);
|
||||
this->tss_fields[TSF_FORMAT].set_width(15);
|
||||
this->tss_fields[TSF_FORMAT].right_justify(true);
|
||||
this->tss_fields[TSF_FILENAME].set_min_width(35); /* XXX */
|
||||
@ -69,7 +66,6 @@ public:
|
||||
this->tss_fields[TSF_FILENAME].right_justify(true);
|
||||
};
|
||||
|
||||
lv_functor_t marks_wire;
|
||||
lv_functor_t filename_wire;
|
||||
|
||||
size_t statusview_fields(void) { return TSF__MAX; };
|
||||
@ -91,41 +87,6 @@ public:
|
||||
sf.set_value(buffer);
|
||||
};
|
||||
|
||||
void update_marks(listview_curses *lc)
|
||||
{
|
||||
textview_curses *tc = dynamic_cast<textview_curses *>(lc);
|
||||
status_field & sfw = this->tss_fields[TSF_WARNINGS];
|
||||
status_field & sfe = this->tss_fields[TSF_ERRORS];
|
||||
vis_bookmarks & bm = tc->get_bookmarks();
|
||||
unsigned long width;
|
||||
vis_line_t height;
|
||||
|
||||
tc->get_dimensions(height, width);
|
||||
if (bm.find(&logfile_sub_source::BM_WARNINGS) != bm.end()) {
|
||||
bookmark_vector<vis_line_t> &bv =
|
||||
bm[&logfile_sub_source::BM_WARNINGS];
|
||||
bookmark_vector<vis_line_t>::iterator iter;
|
||||
|
||||
iter = lower_bound(bv.begin(), bv.end(), tc->get_top());
|
||||
sfw.set_value("%9dW", distance(bv.begin(), iter));
|
||||
}
|
||||
else {
|
||||
sfw.clear();
|
||||
}
|
||||
|
||||
if (bm.find(&logfile_sub_source::BM_ERRORS) != bm.end()) {
|
||||
bookmark_vector<vis_line_t> &bv =
|
||||
bm[&logfile_sub_source::BM_ERRORS];
|
||||
bookmark_vector<vis_line_t>::iterator iter;
|
||||
|
||||
iter = lower_bound(bv.begin(), bv.end(), tc->get_top());
|
||||
sfe.set_value("%9dE", distance(bv.begin(), iter));
|
||||
}
|
||||
else {
|
||||
sfe.clear();
|
||||
}
|
||||
};
|
||||
|
||||
void update_filename(listview_curses *lc)
|
||||
{
|
||||
status_field &sf_format = this->tss_fields[TSF_FORMAT];
|
||||
@ -143,17 +104,22 @@ public:
|
||||
iter = sa[lr].find("file");
|
||||
if (iter != sa[lr].end()) {
|
||||
logfile *lf = (logfile *)iter->second.sa_ptr;
|
||||
struct line_range lr = { 0, 1 };
|
||||
|
||||
if (lf->get_format()) {
|
||||
sf_format.set_value("(%s)",
|
||||
sf_format.set_value("< % 13s",
|
||||
lf->get_format()->get_name().c_str());
|
||||
}
|
||||
else if (!lf->get_filename().empty()) {
|
||||
sf_format.set_value("(unknown)");
|
||||
sf_format.set_value("< % 13s", "unknown");
|
||||
}
|
||||
else{
|
||||
sf_format.clear();
|
||||
}
|
||||
|
||||
sf_format.get_value().get_attrs()[lr].insert(
|
||||
make_string_attr("style", A_BOLD|COLOR_PAIR(
|
||||
view_colors::VC_GREEN_ON_WHITE)));
|
||||
sf_filename.set_value(lf->get_filename());
|
||||
}
|
||||
else {
|
||||
|
@ -125,6 +125,8 @@ drive_vt52_curses_SOURCES = \
|
||||
drive_vt52_curses_LDADD = $(CURSES_LIB)
|
||||
|
||||
drive_readline_curses_SOURCES = \
|
||||
../src/ansi_scrubber.cc \
|
||||
../src/pcrepp.cc \
|
||||
../src/vt52_curses.cc \
|
||||
../src/readline_curses.cc \
|
||||
../src/view_curses.cc \
|
||||
|
@ -134,7 +134,8 @@ am_drive_logfile_OBJECTS = logfile.$(OBJEXT) log_format.$(OBJEXT) \
|
||||
drive_logfile_OBJECTS = $(am_drive_logfile_OBJECTS)
|
||||
drive_logfile_LDADD = $(LDADD)
|
||||
drive_logfile_DEPENDENCIES =
|
||||
am_drive_readline_curses_OBJECTS = vt52_curses.$(OBJEXT) \
|
||||
am_drive_readline_curses_OBJECTS = ansi_scrubber.$(OBJEXT) \
|
||||
pcrepp.$(OBJEXT) vt52_curses.$(OBJEXT) \
|
||||
readline_curses.$(OBJEXT) view_curses.$(OBJEXT) \
|
||||
drive_readline_curses.$(OBJEXT)
|
||||
drive_readline_curses_OBJECTS = $(am_drive_readline_curses_OBJECTS)
|
||||
@ -699,6 +700,8 @@ drive_vt52_curses_SOURCES = \
|
||||
|
||||
drive_vt52_curses_LDADD = $(CURSES_LIB)
|
||||
drive_readline_curses_SOURCES = \
|
||||
../src/ansi_scrubber.cc \
|
||||
../src/pcrepp.cc \
|
||||
../src/vt52_curses.cc \
|
||||
../src/readline_curses.cc \
|
||||
../src/view_curses.cc \
|
||||
@ -901,6 +904,7 @@ mostlyclean-compile:
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ansi_scrubber.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bookmarks.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drive_data_scanner.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drive_grep_proc.Po@am__quote@
|
||||
@ -1047,6 +1051,20 @@ log_format.obj: ../src/log_format.cc
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o log_format.obj `if test -f '../src/log_format.cc'; then $(CYGPATH_W) '../src/log_format.cc'; else $(CYGPATH_W) '$(srcdir)/../src/log_format.cc'; fi`
|
||||
|
||||
ansi_scrubber.o: ../src/ansi_scrubber.cc
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ansi_scrubber.o -MD -MP -MF $(DEPDIR)/ansi_scrubber.Tpo -c -o ansi_scrubber.o `test -f '../src/ansi_scrubber.cc' || echo '$(srcdir)/'`../src/ansi_scrubber.cc
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ansi_scrubber.Tpo $(DEPDIR)/ansi_scrubber.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/ansi_scrubber.cc' object='ansi_scrubber.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ansi_scrubber.o `test -f '../src/ansi_scrubber.cc' || echo '$(srcdir)/'`../src/ansi_scrubber.cc
|
||||
|
||||
ansi_scrubber.obj: ../src/ansi_scrubber.cc
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ansi_scrubber.obj -MD -MP -MF $(DEPDIR)/ansi_scrubber.Tpo -c -o ansi_scrubber.obj `if test -f '../src/ansi_scrubber.cc'; then $(CYGPATH_W) '../src/ansi_scrubber.cc'; else $(CYGPATH_W) '$(srcdir)/../src/ansi_scrubber.cc'; fi`
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ansi_scrubber.Tpo $(DEPDIR)/ansi_scrubber.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../src/ansi_scrubber.cc' object='ansi_scrubber.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ansi_scrubber.obj `if test -f '../src/ansi_scrubber.cc'; then $(CYGPATH_W) '../src/ansi_scrubber.cc'; else $(CYGPATH_W) '$(srcdir)/../src/ansi_scrubber.cc'; fi`
|
||||
|
||||
vt52_curses.o: ../src/vt52_curses.cc
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT vt52_curses.o -MD -MP -MF $(DEPDIR)/vt52_curses.Tpo -c -o vt52_curses.o `test -f '../src/vt52_curses.cc' || echo '$(srcdir)/'`../src/vt52_curses.cc
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/vt52_curses.Tpo $(DEPDIR)/vt52_curses.Po
|
||||
|
Loading…
Reference in New Issue
Block a user