[readline] customize display of matches for completion

pull/97/head
Timothy Stack 10 years ago
parent 5918ffe069
commit 43e6b55a81

@ -52,6 +52,7 @@ listview_curses::listview_curses()
lv_height(0),
lv_needs_update(true),
lv_show_scrollbar(true),
lv_show_bottom_border(false),
lv_gutter_source(&DEFAULT_GUTTER_SOURCE),
lv_word_wrap(false),
lv_scroll_accel(0),
@ -176,6 +177,7 @@ void listview_curses::do_update(void)
}
this->get_dimensions(height, width);
wrap_width = width - (this->lv_word_wrap ? 1 : this->lv_show_scrollbar ? 1 : 0);
row_count = this->get_inner_height();
@ -232,9 +234,12 @@ void listview_curses::do_update(void)
lines = y + min(height, vis_line_t(
(int)(coverage * (double)height)));
for (int gutter_y = this->lv_y; gutter_y <= height; gutter_y++) {
int range_start = 0, range_end, ch;
for (int gutter_y = this->lv_y;
gutter_y < (this->lv_y + height);
gutter_y++) {
int range_start = 0, range_end;
int fg = COLOR_WHITE, bg = COLOR_BLACK, attrs;
chtype ch = ACS_VLINE;
if (row_count > 0) {
range_start = (double)(gutter_y - this->lv_y) * adjusted_height;
@ -257,6 +262,11 @@ void listview_curses::do_update(void)
wmove(this->lv_window, this->lv_y + height - 1, 0);
}
if (this->lv_show_bottom_border) {
mvwchgat(this->lv_window,
this->lv_y + height - 1, 0, width - 1, A_UNDERLINE, 0, NULL);
}
this->lv_needs_update = false;
}
}

@ -80,8 +80,9 @@ public:
};
virtual void listview_gutter_value_for_range(const listview_curses &lv, int start, int end,
int &ch_out, int &fg_out) {
virtual void listview_gutter_value_for_range(
const listview_curses &lv, int start, int end,
chtype &ch_out, int &fg_out) {
ch_out = ACS_VLINE;
fg_out = COLOR_WHITE;
};
@ -177,6 +178,9 @@ public:
void set_show_scrollbar(bool ss) { this->lv_show_scrollbar = ss; };
bool get_show_scrollbar() const { return this->lv_show_scrollbar; };
void set_show_bottom_border(bool val) { this->lv_show_bottom_border = val; };
bool get_show_bottom_border() const { return this->lv_show_bottom_border; };
void set_word_wrap(bool ww) {
bool scroll_down = this->lv_top >= this->get_top_for_last_row();
@ -463,6 +467,7 @@ protected:
* is needed.
*/
bool lv_show_scrollbar; /*< Draw the scrollbar in the view. */
bool lv_show_bottom_border;
list_gutter_source *lv_gutter_source;
bool lv_word_wrap;

@ -162,8 +162,8 @@ static const char *view_titles[LNV__MAX] = {
class log_gutter_source : public list_gutter_source {
public:
void listview_gutter_value_for_range(const listview_curses &lv, int start, int end,
int &ch, int &fg_out) {
void listview_gutter_value_for_range(
const listview_curses &lv, int start, int end, chtype &ch, int &fg_out) {
textview_curses *tc = (textview_curses *)&lv;
vis_bookmarks &bm = tc->get_bookmarks();
vis_line_t next;
@ -462,8 +462,9 @@ static void add_text_possibilities(int context, const std::string &str)
switch (dt) {
case DT_DATE:
case DT_TIME:
case DT_WHITE:
continue;
default:
default:
break;
}
@ -869,6 +870,10 @@ public:
}
};
plain_text_source(const vector<string> &lines) {
this->tds_lines = lines;
};
size_t text_line_count()
{
return this->tds_lines.size();
@ -2622,6 +2627,71 @@ static void rl_callback(void *dummy, readline_curses *rc)
}
}
static void rl_display_matches(void *dummy, readline_curses *rc)
{
const std::vector<std::string> &matches = rc->get_matches();
textview_curses &tc = lnav_data.ld_match_view;
unsigned long width, height;
int max_len, cols, rows, match_height, bottom_height;
getmaxyx(lnav_data.ld_window, height, width);
max_len = rc->get_max_match_length() + 2;
cols = width / max_len;
rows = (matches.size() + cols - 1) / cols;
match_height = min((unsigned long)rows, (height - 4) / 2);
bottom_height = match_height + 1 + rc->get_height();
for (int lpc = 0; lpc < LNV__MAX; lpc++) {
lnav_data.ld_views[lpc].set_height(vis_line_t(-bottom_height));
}
lnav_data.ld_status[LNS_BOTTOM].set_top(-bottom_height);
if (tc.get_sub_source() != NULL) {
delete tc.get_sub_source();
}
if (cols == 1) {
tc.set_sub_source(new plain_text_source(rc->get_matches()));
}
else {
std::vector<std::string> horiz_matches;
horiz_matches.resize(rows);
for (int lpc = 0; lpc < matches.size(); lpc++) {
int curr_row = lpc % rows;
horiz_matches[curr_row].append(matches[lpc]);
horiz_matches[curr_row].append(
max_len - matches[lpc].length(), ' ');
}
tc.set_sub_source(new plain_text_source(horiz_matches));
}
if (match_height > 0) {
tc.set_window(lnav_data.ld_window);
tc.set_y(height - bottom_height + 1);
tc.set_height(vis_line_t(match_height));
tc.reload_data();
}
else {
tc.set_window(NULL);
}
}
static void rl_display_next(void *dummy, readline_curses *rc)
{
textview_curses &tc = lnav_data.ld_match_view;
if (tc.get_top() >= (tc.get_top_for_last_row() - 1)) {
tc.set_top(vis_line_t(0));
}
else {
tc.shift_top(tc.get_height());
}
}
static void usage(void)
{
const char *usage_msg =
@ -3269,9 +3339,12 @@ static void looper(void)
rlc.set_perform_action(readline_curses::action(rl_callback));
rlc.set_timeout_action(readline_curses::action(rl_search));
rlc.set_abort_action(readline_curses::action(rl_abort));
rlc.set_display_match_action(
readline_curses::action(rl_display_matches));
rlc.set_display_next_action(
readline_curses::action(rl_display_next));
rlc.set_alt_value(HELP_MSG_2(
e, E,
"to move forward/backward through error messages"));
e, E, "to move forward/backward through error messages"));
(void)curs_set(0);
@ -3282,7 +3355,7 @@ static void looper(void)
lnav_data.ld_views[lpc].set_window(lnav_data.ld_window);
lnav_data.ld_views[lpc].set_y(1);
lnav_data.ld_views[lpc].
set_height(vis_line_t(-(rlc.get_height() + 1 + 1)));
set_height(vis_line_t(-(rlc.get_height() + 1)));
lnav_data.ld_views[lpc].
set_scroll_action(sb.get_functor());
lnav_data.ld_views[lpc].set_search_action(
@ -3290,13 +3363,17 @@ static void looper(void)
}
lnav_data.ld_status[LNS_TOP].set_top(0);
lnav_data.ld_status[LNS_BOTTOM].set_top(-(rlc.get_height() + 1));
for (lpc = 0; lpc < LNS__MAX; lpc++) {
lnav_data.ld_status[lpc].set_window(lnav_data.ld_window);
}
lnav_data.ld_status[LNS_TOP].
set_data_source(&lnav_data.ld_top_source);
lnav_data.ld_status[LNS_BOTTOM].
set_data_source(&lnav_data.ld_bottom_source);
lnav_data.ld_status[LNS_TOP].set_data_source(
&lnav_data.ld_top_source);
lnav_data.ld_status[LNS_BOTTOM].set_data_source(
&lnav_data.ld_bottom_source);
lnav_data.ld_match_view.set_show_bottom_border(true);
sb.push_back(view_action<listview_curses>(update_times));
sb.push_back(&lnav_data.ld_top_source.filename_wire);
sb.push_back(&lnav_data.ld_bottom_source.line_number_wire);
@ -3329,14 +3406,9 @@ static void looper(void)
rebuild_indexes(true);
}
for (lpc = 0; lpc < LNV__MAX; lpc++) {
lnav_data.ld_views[lpc]
.set_height(vis_line_t(-(rlc.get_height() + 1)));
}
lnav_data.ld_status[LNS_BOTTOM].set_top(-(rlc.get_height() + 1));
lnav_data.ld_view_stack.top()->do_update();
lnav_data.ld_status[LNS_TOP].do_update();
lnav_data.ld_view_stack.top()->do_update();
lnav_data.ld_match_view.do_update();
lnav_data.ld_status[LNS_BOTTOM].do_update();
rlc.do_update();
refresh();
@ -3712,9 +3784,11 @@ static void setup_highlights(textview_curses::highlight_map_t &hm)
"\\bcatch\\b|"
"\\bchar\\b|"
"\\bclass\\b|"
"\\bcollate\\b|"
"\\bconst\\b|"
"\\bcontinue\\b|"
"\\bcreate |"
"\\bcreate\\s+(?:virtual)?|"
"\\bdatetime\\b|"
"\\bdef |"
"\\bdefault[:\\s]|"
"\\bdo\\b|"
@ -3735,6 +3809,7 @@ static void setup_highlights(textview_curses::highlight_map_t &hm)
"\\bfi\\b|"
"\\bfloat\\b|"
"\\bfor\\b|"
"\\bforeign\\s+key\\b|"
"\\bfrom |"
"\\bgoto\\b|"
"\\bgroup by |"
@ -3743,6 +3818,7 @@ static void setup_highlights(textview_curses::highlight_map_t &hm)
"\\bimplements\\b|"
"\\bin\\b|"
"\\binline\\b|"
"\\binner\\b|"
"\\binsert |"
"\\bint\\b|"
"\\binto\\b|"
@ -3759,10 +3835,12 @@ static void setup_highlights(textview_curses::highlight_map_t &hm)
"\\bor\\b|"
"\\border by |"
"\\bpackage\\b|"
"\\bprimary\\s+key\\b|"
"\\bprivate\\b|"
"\\bprotected\\b|"
"\\bpublic\\b|"
"\\braise\\b|"
"\\breferences\\b|"
"\\b(?<!@)return\\b|"
"\\bselect |"
"\\bself\\b|"
@ -3786,6 +3864,7 @@ static void setup_highlights(textview_curses::highlight_map_t &hm)
"\\bupdate |"
"\\busing |"
"\\bvar\\b|"
"\\bview\\b|"
"\\bvoid\\b|"
"\\bvolatile\\b|"
"\\bwhere |"
@ -4079,6 +4158,8 @@ int main(int argc, char *argv[])
set_overlay_source(new field_overlay_source(lnav_data.ld_log_source));
lnav_data.ld_db_overlay.dos_hist_source = &lnav_data.ld_db_source;
lnav_data.ld_match_view.set_left(0);
for (int lpc = 0; lpc < LNV__MAX; lpc++) {
lnav_data.ld_views[lpc].set_gutter_source(new log_gutter_source());
}
@ -4086,6 +4167,7 @@ int main(int argc, char *argv[])
{
setup_highlights(lnav_data.ld_views[LNV_LOG].get_highlights());
setup_highlights(lnav_data.ld_views[LNV_TEXT].get_highlights());
setup_highlights(lnav_data.ld_views[LNV_SCHEMA].get_highlights());
}
{

@ -168,6 +168,8 @@ struct _lnav_data {
time_t ld_bottom_time;
int ld_bottom_time_millis;
textview_curses ld_match_view;
std::stack<textview_curses *> ld_view_stack;
textview_curses ld_views[LNV__MAX];
std::auto_ptr<grep_highlighter> ld_search_child[LNV__MAX];

@ -76,13 +76,14 @@ static const char *RL_INIT[] = {
* up if it wraps around.
*/
"set horizontal-scroll-mode on",
"set completion-prefix-display-length 3",
NULL
};
readline_context *readline_context::loaded_context;
set<string> * readline_context::arg_possibilities;
static string last_match_str;
static bool last_match_str_valid;
static void sigalrm(int sig)
{
@ -106,26 +107,82 @@ static void line_ready_tramp(char *line)
rl_callback_handler_remove();
}
static int reliable_send(int sock, char *buf, size_t len)
static int sendall(int sock, const char *buf, size_t len)
{
int retval;
off_t offset = 0;
while ((retval = send(sock, buf, len, 0)) == -1) {
if (errno == ENOBUFS) {
fd_set ready_wfds;
while (len > 0) {
int rc = send(sock, &buf[offset], len, 0);
FD_ZERO(&ready_wfds);
FD_SET(sock, &ready_wfds);
select(sock + 1, NULL, &ready_wfds, NULL, NULL);
if (rc == -1) {
switch (errno) {
case EAGAIN:
case EINTR:
break;
default:
return -1;
}
}
else if (errno == EINTR) {
continue;
else {
len -= rc;
offset += rc;
}
}
return 0;
}
static int sendstring(int sock, const char *buf, size_t len)
{
if (sendall(sock, (char *)&len, sizeof(len)) == -1) {
return -1;
}
else if (sendall(sock, buf, len) == -1) {
return -1;
}
return 0;
}
static int recvall(int sock, char *buf, size_t len)
{
off_t offset = 0;
while (len > 0) {
int rc = recv(sock, &buf[offset], len, 0);
if (rc == -1) {
switch (errno) {
case EAGAIN:
case EINTR:
break;
default:
return -1;
}
}
else {
break;
len -= rc;
offset += rc;
}
}
return 0;
}
static ssize_t recvstring(int sock, char *buf, size_t len)
{
ssize_t retval;
if (recvall(sock, (char *)&retval, sizeof(retval)) == -1) {
return -1;
}
else if (retval > len) {
return -1;
}
else if (recvall(sock, buf, retval) == -1) {
return -1;
}
return retval;
}
@ -156,6 +213,19 @@ char *readline_context::completion_generator(const char *text, int state)
}
}
if (matches.size() == 1) {
if (strcmp(text, matches[0].c_str()) == 0) {
matches.pop_back();
}
last_match_str_valid = false;
if (sendstring(child_this->rc_command_pipe[readline_curses::RCF_SLAVE],
"m:0:0",
5) == -1) {
_exit(1);
}
}
if (!matches.empty()) {
retval = strdup(matches.back().c_str());
matches.pop_back();
@ -212,12 +282,13 @@ char **readline_context::attempted_completion(const char *text,
readline_curses::readline_curses()
: rc_active_context(-1),
rc_child(-1),
rc_value_expiration(0)
rc_value_expiration(0),
rc_matches_remaining(0)
{
struct winsize ws;
int sp[2];
if (socketpair(PF_UNIX, SOCK_DGRAM, 0, sp) < 0) {
if (socketpair(PF_UNIX, SOCK_STREAM, 0, sp) < 0) {
throw error(errno);
}
@ -290,6 +361,35 @@ readline_curses::~readline_curses()
}
}
void readline_curses::store_matches(
char **matches, int num_matches, int max_len)
{
char msg[64];
int rc;
if (last_match_str_valid && strcmp(last_match_str.c_str(), matches[0]) == 0) {
if (sendstring(child_this->rc_command_pipe[RCF_SLAVE], "n", 1) == -1) {
_exit(1);
}
}
else {
rc = snprintf(msg, sizeof(msg), "m:%d:%d", num_matches, max_len);
if (sendstring(child_this->rc_command_pipe[RCF_SLAVE], msg, rc) == -1) {
_exit(1);
}
for (int lpc = 1; lpc <= num_matches; lpc++) {
if (sendstring(child_this->rc_command_pipe[RCF_SLAVE],
matches[lpc],
strlen(matches[lpc])) == -1) {
_exit(1);
}
}
last_match_str = matches[0];
last_match_str_valid = true;
}
}
void readline_curses::start(void)
{
if (this->rc_child != 0) {
@ -303,6 +403,7 @@ void readline_curses::start(void)
require(!this->rc_contexts.empty());
rl_completer_word_break_characters = (char *)" \t\n"; /* XXX */
rl_completion_display_matches_hook = store_matches;
current_context = this->rc_contexts.end();
@ -348,9 +449,9 @@ void readline_curses::start(void)
if (FD_ISSET(this->rc_command_pipe[RCF_SLAVE], &ready_rfds)) {
char msg[1024 + 1];
if ((rc = read(this->rc_command_pipe[RCF_SLAVE],
msg,
sizeof(msg) - 1)) < 0) {
if ((rc = recvstring(this->rc_command_pipe[RCF_SLAVE],
msg,
sizeof(msg) - 1)) < 0) {
}
else {
int context, prompt_start = 0;
@ -364,6 +465,7 @@ void readline_curses::start(void)
current_context->second->load();
rl_callback_handler_install(&msg[prompt_start],
line_ready_tramp);
last_match_str_valid = false;
}
else if (strcmp(msg, "a") == 0) {
char reply[4];
@ -375,11 +477,11 @@ void readline_curses::start(void)
snprintf(reply, sizeof(reply), "a");
if (reliable_send(this->rc_command_pipe[RCF_SLAVE],
reply,
strlen(reply)) == -1) {
if (sendstring(this->rc_command_pipe[RCF_SLAVE],
reply,
strlen(reply)) == -1) {
perror("abort: write failed");
exit(1);
_exit(1);
}
}
else if (sscanf(msg,
@ -419,10 +521,10 @@ void readline_curses::start(void)
got_timeout = 0;
snprintf(msg, sizeof(msg), "t:%s", rl_line_buffer);
if (reliable_send(this->rc_command_pipe[RCF_SLAVE],
msg,
strlen(msg)) == -1) {
exit(1);
if (sendstring(this->rc_command_pipe[RCF_SLAVE],
msg,
strlen(msg)) == -1) {
_exit(1);
}
}
if (got_line) {
@ -469,7 +571,7 @@ void readline_curses::start(void)
citer->second->save();
}
exit(0);
_exit(0);
}
void readline_curses::line_ready(const char *line)
@ -501,11 +603,11 @@ void readline_curses::line_ready(const char *line)
break;
}
if (reliable_send(this->rc_command_pipe[RCF_SLAVE],
msg,
strlen(msg)) == -1) {
if (sendstring(this->rc_command_pipe[RCF_SLAVE],
msg,
strlen(msg)) == -1) {
perror("line_ready: write failed");
exit(1);
_exit(1);
}
{
@ -535,32 +637,59 @@ void readline_curses::check_fd_set(fd_set &ready_rfds)
if (FD_ISSET(this->rc_command_pipe[RCF_MASTER], &ready_rfds)) {
char msg[1024 + 1];
rc = read(this->rc_command_pipe[RCF_MASTER], msg, sizeof(msg) - 1);
if (rc >= 1) {
rc = recvstring(this->rc_command_pipe[RCF_MASTER], msg, sizeof(msg) - 1);
if (rc >= 0) {
string old_value = this->rc_value;
msg[rc] = '\0';
this->rc_value = string(&msg[2]);
switch (msg[0]) {
case 'a':
this->rc_active_context = -1;
this->vc_past_lines.clear();
this->rc_abort.invoke(this);
curs_set(0);
break;
case 't':
if (this->rc_value != old_value) {
this->rc_timeout.invoke(this);
if (this->rc_matches_remaining > 0) {
this->rc_matches.push_back(msg);
this->rc_matches_remaining -= 1;
if (this->rc_matches_remaining == 0) {
this->rc_display_match.invoke(this);
}
break;
}
else if (msg[0] == 'm') {
sscanf(msg, "m:%d:%d", &this->rc_matches_remaining,
&this->rc_max_match_length);
this->rc_matches.clear();
if (this->rc_matches_remaining == 0) {
this->rc_display_match.invoke(this);
}
}
else {
this->rc_value = string(&msg[2]);
switch (msg[0]) {
case 'a':
require(rc == 1);
this->rc_active_context = -1;
this->vc_past_lines.clear();
this->rc_matches.clear();
this->rc_abort.invoke(this);
this->rc_display_match.invoke(this);
curs_set(0);
break;
case 'd':
this->rc_active_context = -1;
this->vc_past_lines.clear();
this->rc_perform.invoke(this);
curs_set(0);
break;
case 't':
if (this->rc_value != old_value) {
this->rc_timeout.invoke(this);
}
break;
case 'd':
this->rc_active_context = -1;
this->vc_past_lines.clear();
this->rc_matches.clear();
this->rc_perform.invoke(this);
this->rc_display_match.invoke(this);
curs_set(0);
break;
case 'n':
this->rc_display_next.invoke(this);
break;
}
}
}
}
@ -589,9 +718,9 @@ void readline_curses::focus(int context, const char *prompt)
this->rc_active_context = context;
snprintf(buffer, sizeof(buffer), "f:%d:%s", context, prompt);
if (reliable_send(this->rc_command_pipe[RCF_MASTER],
buffer,
strlen(buffer) + 1) == -1) {
if (sendstring(this->rc_command_pipe[RCF_MASTER],
buffer,
strlen(buffer) + 1) == -1) {
perror("focus: write failed");
}
wmove(this->vc_window, this->get_actual_y(), 0);
@ -603,9 +732,9 @@ void readline_curses::abort()
char buffer[1024];
snprintf(buffer, sizeof(buffer), "a");
if (reliable_send(this->rc_command_pipe[RCF_MASTER],
buffer,
strlen(buffer) + 1) == -1) {
if (sendstring(this->rc_command_pipe[RCF_MASTER],
buffer,
strlen(buffer)) == -1) {
perror("abort: write failed");
}
}
@ -616,12 +745,16 @@ void readline_curses::add_possibility(int context,
{
char buffer[1024];
if (value.empty()) {
return;
}
snprintf(buffer, sizeof(buffer),
"ap:%d:%s:%s",
context, type.c_str(), value.c_str());
if (reliable_send(this->rc_command_pipe[RCF_MASTER],
buffer,
strlen(buffer) + 1) == -1) {
if (sendstring(this->rc_command_pipe[RCF_MASTER],
buffer,
strlen(buffer) + 1) == -1) {
perror("add_possibility: write failed");
}
}
@ -635,9 +768,9 @@ void readline_curses::rem_possibility(int context,
snprintf(buffer, sizeof(buffer),
"rp:%d:%s:%s",
context, type.c_str(), value.c_str());
if (reliable_send(this->rc_command_pipe[RCF_MASTER],
buffer,
strlen(buffer) + 1) == -1) {
if (sendstring(this->rc_command_pipe[RCF_MASTER],
buffer,
strlen(buffer) + 1) == -1) {
perror("rem_possiblity: write failed");
}
}
@ -649,9 +782,9 @@ void readline_curses::clear_possibilities(int context, string type)
snprintf(buffer, sizeof(buffer),
"cp:%d:%s",
context, type.c_str());
if (reliable_send(this->rc_command_pipe[RCF_MASTER],
buffer,
strlen(buffer) + 1) == -1) {
if (sendstring(this->rc_command_pipe[RCF_MASTER],
buffer,
strlen(buffer) + 1) == -1) {
perror("clear_possiblity: write failed");
}
}

@ -217,6 +217,8 @@ public:
void set_perform_action(action va) { this->rc_perform = va; };
void set_timeout_action(action va) { this->rc_timeout = va; };
void set_abort_action(action va) { this->rc_abort = va; };
void set_display_match_action(action va) { this->rc_display_match = va; };
void set_display_next_action(action va) { this->rc_display_next = va; };
void set_value(const std::string &value)
{
@ -284,6 +286,14 @@ public:
const std::string &value);
void clear_possibilities(int context, std::string type);
const std::vector<std::string> &get_matches() const {
return this->rc_matches;
};
int get_max_match_length() const {
return this->rc_max_match_length;
};
private:
enum {
RCF_MASTER,
@ -292,6 +302,10 @@ private:
RCF_MAX_VALUE,
};
static void store_matches(char **matches, int num_matches, int max_len);
friend class readline_context;
int rc_active_context;
pid_t rc_child;
auto_fd rc_pty[2];
@ -300,9 +314,14 @@ private:
std::string rc_value;
time_t rc_value_expiration;
std::string rc_alt_value;
int rc_matches_remaining;
int rc_max_match_length;
std::vector<std::string> rc_matches;
action rc_perform;
action rc_timeout;
action rc_abort;
action rc_display_match;
action rc_display_next;
};
#endif

@ -337,7 +337,7 @@ void readline_sqlite_highlighter(attr_line_t &al, int x)
static int error_attrs = (
A_BOLD|A_REVERSE|view_colors::ansi_color_pair(COLOR_RED, COLOR_BLACK));
static string keyword_re_str = sql_keyword_re();
static string keyword_re_str = sql_keyword_re() + "|\\.schema";
static pcrepp keyword_pcre(keyword_re_str.c_str(), PCRE_CASELESS);
static pcrepp string_literal_pcre("'[^']*('(?:'[^']*')*|$)");
static pcrepp ident_pcre("(\\b[a-z_]\\w*)|\"([^\"]+)\"|\\[([^\\]]+)]", PCRE_CASELESS);
@ -359,7 +359,7 @@ void readline_sqlite_highlighter(attr_line_t &al, int x)
int attrs = vc.attrs_for_ident(pi.get_substr_start(cap), cap->length());
struct line_range lr(cap->c_begin, cap->c_end);
if (line[cap->c_end] == '(') {
if (line[cap->c_begin] == '.' || line[cap->c_end] == '(') {
}
else if (!lr.contains(x) && !lr.contains(x - 1)) {

@ -34,3 +34,21 @@ log_line,log_part
1,middle
2,middle
EOF
run_test ${lnav_test} -nSq \
-c ":adjust-log-time 2010-01-01T00:00:00" \
${test_dir}/logfile_access_log.0
check_output "adjust time is not working" <<EOF
EOF
run_test ${lnav_test} -nS \
${test_dir}/logfile_access_log.0
check_output "adjust time is not saved in session" <<EOF
192.168.202.254 - - [01/Jan/2010:00:00:00 +0000] "GET /vmw/cgi/tramp HTTP/1.0" 200 134 "-" "gPXE/0.9.7"
192.168.202.254 - - [01/Jan/2010:00:00:03 +0000] "GET /vmw/vSphere/default/vmkboot.gz HTTP/1.0" 404 46210 "-" "gPXE/0.9.7"
192.168.202.254 - - [01/Jan/2010:00:00:03 +0000] "GET /vmw/vSphere/default/vmkernel.gz HTTP/1.0" 200 78929 "-" "gPXE/0.9.7"
EOF

Loading…
Cancel
Save