mirror of https://github.com/tstack/lnav.git
parent
a813482a54
commit
7309352c97
|
@ -47,11 +47,17 @@
|
|||
* Encapsulates a range in a string.
|
||||
*/
|
||||
struct line_range {
|
||||
enum class unit {
|
||||
bytes,
|
||||
codepoint,
|
||||
};
|
||||
|
||||
int lr_start;
|
||||
int lr_end;
|
||||
unit lr_unit;
|
||||
|
||||
explicit line_range(int start = -1, int end = -1)
|
||||
: lr_start(start), lr_end(end)
|
||||
explicit line_range(int start = -1, int end = -1, unit u = unit::bytes)
|
||||
: lr_start(start), lr_end(end), lr_unit(u)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ hist_source2::add_value(time_t row,
|
|||
this->hs_last_row = row;
|
||||
}
|
||||
|
||||
bucket_t& bucket = this->find_bucket(this->hs_last_bucket);
|
||||
auto& bucket = this->find_bucket(this->hs_last_bucket);
|
||||
bucket.b_time = row;
|
||||
bucket.b_values[htype].hv_value += value;
|
||||
}
|
||||
|
|
|
@ -175,6 +175,8 @@ public:
|
|||
struct line_range lr;
|
||||
vis_line_t height;
|
||||
|
||||
lr.lr_unit = line_range::unit::codepoint;
|
||||
|
||||
size_t ident_to_show = this->sbc_show_state.match(
|
||||
[](const show_none) { return -1; },
|
||||
[ident_index](const show_all) { return ident_index; },
|
||||
|
|
|
@ -251,18 +251,20 @@ view_curses::mvwattrline(WINDOW* window,
|
|||
continue;
|
||||
}
|
||||
|
||||
for (const auto& adj : utf_adjustments) {
|
||||
// If the UTF adjustment is in the viewport, we need to adjust this
|
||||
// attribute.
|
||||
if (adj.uda_origin < iter->sa_range.lr_start) {
|
||||
attr_range.lr_start += adj.uda_offset;
|
||||
}
|
||||
}
|
||||
|
||||
if (attr_range.lr_end != -1) {
|
||||
if (attr_range.lr_unit == line_range::unit::bytes) {
|
||||
for (const auto& adj : utf_adjustments) {
|
||||
if (adj.uda_origin < iter->sa_range.lr_end) {
|
||||
attr_range.lr_end += adj.uda_offset;
|
||||
// If the UTF adjustment is in the viewport, we need to adjust
|
||||
// this attribute.
|
||||
if (adj.uda_origin < iter->sa_range.lr_start) {
|
||||
attr_range.lr_start += adj.uda_offset;
|
||||
}
|
||||
}
|
||||
|
||||
if (attr_range.lr_end != -1) {
|
||||
for (const auto& adj : utf_adjustments) {
|
||||
if (adj.uda_origin < iter->sa_range.lr_end) {
|
||||
attr_range.lr_end += adj.uda_offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -536,6 +536,8 @@ EXPECTED_FILES = \
|
|||
$(srcdir)/%reldir%/test_sql.sh_b2694e4fbecdd128798af25ee0d069e7e35fb499.out \
|
||||
$(srcdir)/%reldir%/test_sql.sh_b5aa0561a65de7e8e22085db184c72a94b1a89a9.err \
|
||||
$(srcdir)/%reldir%/test_sql.sh_b5aa0561a65de7e8e22085db184c72a94b1a89a9.out \
|
||||
$(srcdir)/%reldir%/test_sql.sh_bad03a996c0750733ab99c592b9011851f521a69.err \
|
||||
$(srcdir)/%reldir%/test_sql.sh_bad03a996c0750733ab99c592b9011851f521a69.out \
|
||||
$(srcdir)/%reldir%/test_sql.sh_bd46ca4560f8be6307a914e39539bbac0368080a.err \
|
||||
$(srcdir)/%reldir%/test_sql.sh_bd46ca4560f8be6307a914e39539bbac0368080a.out \
|
||||
$(srcdir)/%reldir%/test_sql.sh_c20b0320096342c180146a5d18a6de82319d70b2.err \
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
[1m[4mmatch_index [0m[1m[4m content [0m[1m[4m case match_index when 2 then replicate('abc', 1000) else '' end [0m
|
||||
[1m[7m [0m[1m 0[0m[1m [0m[1m{"col_0":10}[0m[1m [0m[1m [0m
|
||||
[7m 1[0m[7m [0m[7m{"col_0":50}[0m[7m [0m[7m [0m
|
||||
[1m[7m 2[0m[1m[7m [0m[1m[7m{"col_0":50}[0m[1m[7m [0m[1m[7mabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc⋯bcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc [0m
|
||||
[7m 3[0m[7m [0m[7m{"col_0":50}[0m[7m [0m[7m [0m
|
|
@ -1092,3 +1092,6 @@ run_cap_test ${lnav_test} -n \
|
|||
-c ':switch-to-view db' \
|
||||
-c ';SELECT lnav_top_file()' \
|
||||
${test_dir}/logfile_access_log.0
|
||||
|
||||
run_cap_test ${lnav_test} -Nn \
|
||||
-c ";select *,case match_index when 2 then replicate('abc', 1000) else '' end from regexp_capture_into_json('10;50;50;50;', '(\d+);')"
|
||||
|
|
Loading…
Reference in New Issue