mirror of https://github.com/tstack/lnav.git
[view_curses] minor fix for ansi display
This commit is contained in:
parent
ae08c12aa0
commit
bda6fe46b1
|
@ -41,7 +41,7 @@ using namespace std;
|
|||
|
||||
static pcrepp &ansi_regex()
|
||||
{
|
||||
static pcrepp retval("\x1b\\[([\\d=;]*)([a-zA-Z])");
|
||||
static pcrepp retval("\x1b\\[([\\d=;\\?]*)([a-zA-Z])");
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
@ -120,6 +120,19 @@ void scrub_ansi_string(std::string &str, string_attrs_t &sa)
|
|||
break;
|
||||
}
|
||||
|
||||
case 'H': {
|
||||
unsigned int row = 0, spaces = 0;
|
||||
|
||||
if (sscanf(&(str[caps[1].c_begin]), "%u;%u", &row, &spaces) == 2 &&
|
||||
spaces > 1) {
|
||||
spaces -= 1;
|
||||
if (spaces > caps[0].c_begin) {
|
||||
str.insert((unsigned long) caps[0].c_end, spaces - caps[0].c_begin, ' ');
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'O': {
|
||||
int role_int;
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
int row,
|
||||
string_attrs_t &value_out)
|
||||
{
|
||||
if (this->current_file() == NULL) {
|
||||
if (this->current_file() == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -166,8 +166,7 @@ public:
|
|||
};
|
||||
|
||||
void push_back(std::shared_ptr<logfile> lf) {
|
||||
line_filter_observer *lfo = new line_filter_observer(
|
||||
this->get_filters(), lf);
|
||||
auto *lfo = new line_filter_observer(this->get_filters(), lf);
|
||||
lf->set_logline_observer(lfo);
|
||||
this->tss_files.push_back(lf);
|
||||
};
|
||||
|
@ -194,7 +193,7 @@ public:
|
|||
uint32_t old_size = lf->size();
|
||||
logfile::rebuild_result_t new_text_data = lf->rebuild_index();
|
||||
|
||||
if (lf->get_format() != NULL) {
|
||||
if (lf->get_format() != nullptr) {
|
||||
iter = this->tss_files.erase(iter);
|
||||
this->detach_observer(lf);
|
||||
callback.promote_file(lf);
|
||||
|
@ -240,7 +239,7 @@ public:
|
|||
return retval;
|
||||
};
|
||||
|
||||
virtual void text_filters_changed() {
|
||||
void text_filters_changed() {
|
||||
std::shared_ptr<logfile> lf = this->current_file();
|
||||
|
||||
if (lf == nullptr) {
|
||||
|
@ -269,7 +268,7 @@ public:
|
|||
std::shared_ptr<logfile> lf = this->current_file();
|
||||
int retval = 0;
|
||||
|
||||
if (lf != NULL) {
|
||||
if (lf != nullptr) {
|
||||
line_filter_observer *lfo = (line_filter_observer *) lf->get_logline_observer();
|
||||
retval = lf->size() - lfo->lfo_filter_state.tfs_index.size();
|
||||
}
|
||||
|
@ -303,7 +302,7 @@ public:
|
|||
private:
|
||||
void detach_observer(std::shared_ptr<logfile> lf) {
|
||||
line_filter_observer *lfo = (line_filter_observer *) lf->get_logline_observer();
|
||||
lf->set_logline_observer(NULL);
|
||||
lf->set_logline_observer(nullptr);
|
||||
delete lfo;
|
||||
};
|
||||
|
||||
|
|
|
@ -310,9 +310,6 @@ void view_curses::mvwattrline(WINDOW *window,
|
|||
break;
|
||||
|
||||
case '\r':
|
||||
/* exp_index = -1; */
|
||||
break;
|
||||
|
||||
case '\n':
|
||||
expanded_line[exp_index] = ' ';
|
||||
exp_index += 1;
|
||||
|
|
Loading…
Reference in New Issue