[tests] try to make scripty output readable

pull/835/head
Timothy Stack 3 years ago
parent 4d936f7bba
commit 8235f9af5d

@ -149,6 +149,8 @@ grep_output_for() {
on_error_fail_with() { on_error_fail_with() {
if test $? -ne 0; then if test $? -ne 0; then
echo $1 > /dev/stderr echo $1 > /dev/stderr
cat ${test_file_base}_${test_num}.tmp
cat ${test_file_base}_${test_num}.err
exit 1 exit 1
fi fi
} }

@ -56,7 +56,7 @@ public:
auto_mem(const auto_mem &am) = delete; auto_mem(const auto_mem &am) = delete;
template<typename F> template<typename F>
explicit auto_mem(F free_func) explicit auto_mem(F free_func) noexcept
: am_ptr(nullptr), am_free_func((free_func_t)free_func) { }; : am_ptr(nullptr), am_free_func((free_func_t)free_func) { };
auto_mem(auto_mem &&other) noexcept auto_mem(auto_mem &&other) noexcept

@ -39,6 +39,7 @@
#include "optional.hpp" #include "optional.hpp"
#include "strnatcmp.h" #include "strnatcmp.h"
#include "fmt/format.h"
struct string_fragment { struct string_fragment {
using iterator = const char *; using iterator = const char *;
@ -212,6 +213,18 @@ struct string_fragment {
int sf_end; int sf_end;
}; };
namespace fmt {
template<>
struct formatter<string_fragment> : formatter<string_view> {
template<typename FormatContext>
auto format(const string_fragment& sf, FormatContext &ctx)
{
return formatter<string_view>::format(
string_view{sf.data(), (size_t) sf.length()}, ctx);
}
};
}
inline bool operator<(const char *left, const string_fragment &right) { inline bool operator<(const char *left, const string_fragment &right) {
int rc = strncmp(left, right.data(), right.length()); int rc = strncmp(left, right.data(), right.length());
return rc < 0; return rc < 0;

@ -841,6 +841,14 @@ struct Result {
return defaultValue; return defaultValue;
} }
template<typename Func>
auto unwrapOrElse(Func func) const {
if (isOk()) {
return storage().template get<T>();
}
return func(this->storage().template get<E>());
}
template<typename U = T> template<typename U = T>
typename std::enable_if< typename std::enable_if<
!std::is_same<U, void>::value, !std::is_same<U, void>::value,

@ -168,3 +168,10 @@ void split_ws(const std::string &str, std::vector<std::string> &toks_out)
toks_out.push_back(buf); toks_out.push_back(buf);
} }
} }
std::string repeat(const std::string& input, size_t num)
{
std::ostringstream os;
std::fill_n(std::ostream_iterator<std::string>(os), num, input);
return os.str();
}

@ -143,4 +143,6 @@ size_t abbreviate_str(char *str, size_t len, size_t max_len);
void split_ws(const std::string &str, std::vector<std::string> &toks_out); void split_ws(const std::string &str, std::vector<std::string> &toks_out);
std::string repeat(const std::string& input, size_t num);
#endif #endif

@ -163,6 +163,8 @@ void bottom_status_source::update_loading(off_t off, size_t total)
{ {
status_field &sf = this->bss_fields[BSF_LOADING]; status_field &sf = this->bss_fields[BSF_LOADING];
require(off >= 0);
if (total == 0 || (size_t)off == total) { if (total == 0 || (size_t)off == total) {
sf.set_cylon(false); sf.set_cylon(false);
sf.set_role(view_colors::VCR_STATUS); sf.set_role(view_colors::VCR_STATUS);

@ -65,6 +65,10 @@ int sql_progress(const struct log_cursor &lc)
size_t total = lnav_data.ld_log_source.text_line_count(); size_t total = lnav_data.ld_log_source.text_line_count();
off_t off = lc.lc_curr_line; off_t off = lc.lc_curr_line;
if (off < 0) {
return 0;
}
if (lnav_data.ld_window == nullptr) { if (lnav_data.ld_window == nullptr) {
return 0; return 0;
} }

@ -135,8 +135,23 @@ void highlighter::annotate(attr_line_t &al, int start) const
attrs = this->h_attrs; attrs = this->h_attrs;
} }
if (this->h_semantic) { if (this->h_semantic) {
attrs |= vc.attrs_for_ident(&str[lr.lr_start], bool found_color = false;
lr.length());
if (str[lr.lr_start] == '#' &&
(lr.length() == 4 || lr.length() == 7)) {
auto fg_res = rgb_color::from_str(
string_fragment(str.data(), lr.lr_start, lr.lr_end));
if (fg_res.isOk()) {
sa.emplace_back(lr,
&view_curses::VC_FOREGROUND,
vc.match_color(fg_res.unwrap()));
found_color = true;
}
}
if (!found_color) {
attrs |= vc.attrs_for_ident(&str[lr.lr_start],
lr.length());
}
} }
if (!this->h_fg.empty()) { if (!this->h_fg.empty()) {
sa.emplace_back(lr, sa.emplace_back(lr,

@ -1497,6 +1497,8 @@ static void looper()
int session_stage = 0; int session_stage = 0;
while (lnav_data.ld_looping) { while (lnav_data.ld_looping) {
static bool initial_build = false;
vector<struct pollfd> pollfds; vector<struct pollfd> pollfds;
auto poll_to = initial_rescan_completed ? auto poll_to = initial_rescan_completed ?
timeval{ 0, 333000 } : timeval{ 0, 333000 } :
@ -1596,6 +1598,9 @@ static void looper()
POLLIN, POLLIN,
0 0
}); });
if (initial_build) {
view_curses::awaiting_user_input();
}
} }
rlc.update_poll_set(pollfds); rlc.update_poll_set(pollfds);
lnav_data.ld_filter_source.fss_editor.update_poll_set(pollfds); lnav_data.ld_filter_source.fss_editor.update_poll_set(pollfds);
@ -1669,7 +1674,6 @@ static void looper()
}; };
} }
static bool initial_build = false;
if (initial_rescan_completed && if (initial_rescan_completed &&
(!initial_build || timer.fade_diff(index_counter) == 0)) { (!initial_build || timer.fade_diff(index_counter) == 0)) {
if (lnav_data.ld_mode == LNM_PAGING) { if (lnav_data.ld_mode == LNM_PAGING) {

@ -1923,31 +1923,34 @@ void external_log_format::build(std::vector<std::string> &errors) {
for (auto &hd_pair : this->elf_highlighter_patterns) { for (auto &hd_pair : this->elf_highlighter_patterns) {
external_log_format::highlighter_def &hd = hd_pair.second; external_log_format::highlighter_def &hd = hd_pair.second;
const std::string &pattern = hd.hd_pattern; const std::string &pattern = hd.hd_pattern;
std::string errmsg;
const char *errptr; const char *errptr;
rgb_color fg, bg; rgb_color fg, bg;
int eoff, attrs = 0; int eoff, attrs = 0;
if (!hd.hd_color.empty()) { if (!hd.hd_color.empty()) {
if (!rgb_color::from_str(hd.hd_color, fg, errmsg)) { fg = rgb_color::from_str(hd.hd_color)
errors.push_back("error:" .unwrapOrElse([&](const auto& msg) {
+ this->elf_name.to_string() errors.push_back("error:"
+ ":highlighters/" + this->elf_name.to_string()
+ hd_pair.first.to_string() + ":highlighters/"
+ "/color:" + hd_pair.first.to_string()
+ errmsg); + "/color:"
} + msg);
return rgb_color{};
});
} }
if (!hd.hd_background_color.empty()) { if (!hd.hd_background_color.empty()) {
if (!rgb_color::from_str(hd.hd_background_color, bg, errmsg)) { bg = rgb_color::from_str(hd.hd_background_color)
errors.push_back("error:" .unwrapOrElse([&](const auto& msg) {
+ this->elf_name.to_string() errors.push_back("error:"
+ ":highlighters/" + this->elf_name.to_string()
+ hd_pair.first.to_string() + ":highlighters/"
+ "/color:" + hd_pair.first.to_string()
+ errmsg); + "/color:"
} + msg);
return rgb_color{};
});
} }
if (hd.hd_underline) { if (hd.hd_underline) {

@ -1,7 +1,8 @@
AM_CPPFLAGS = \ AM_CPPFLAGS = \
-Wall \ -Wall \
-I$(top_srcdir)/src -I$(top_srcdir)/src \
-I$(top_srcdir)/src/fmtlib
noinst_LIBRARIES = libpcrepp.a noinst_LIBRARIES = libpcrepp.a

@ -238,6 +238,7 @@ public:
{ {
this->rc_value = value; this->rc_value = value;
this->rc_value_expiration = time(nullptr) + VALUE_EXPIRATION; this->rc_value_expiration = time(nullptr) + VALUE_EXPIRATION;
this->set_needs_update();
}; };
std::string get_value() const { return this->rc_value; }; std::string get_value() const { return this->rc_value; };

@ -363,7 +363,7 @@ void readline_command_highlighter(attr_line_t &al, int x)
static const pcrepp SQL_PREFIXES("^:(filter-expr)"); static const pcrepp SQL_PREFIXES("^:(filter-expr)");
static const pcrepp IDENT_PREFIXES("^:(tag|untag|delete-tags)"); static const pcrepp IDENT_PREFIXES("^:(tag|untag|delete-tags)");
static const pcrepp COLOR_PREFIXES("^:(config)"); static const pcrepp COLOR_PREFIXES("^:(config)");
static const pcrepp COLOR_RE("(#(?:[a-fA-F0-9]{3}|[a-fA-F0-9]{6}))"); static const pcrepp COLOR_RE("(#(?:[a-fA-F0-9]{6}|[a-fA-F0-9]{3}))");
view_colors &vc = view_colors::singleton(); view_colors &vc = view_colors::singleton();
int keyword_attrs = ( int keyword_attrs = (
@ -401,19 +401,18 @@ void readline_command_highlighter(attr_line_t &al, int x)
pcre_context::capture_t *cap = pc[0]; pcre_context::capture_t *cap = pc[0];
string hash_color = pi.get_substr(cap); string hash_color = pi.get_substr(cap);
string errmsg; string errmsg;
rgb_color rgb_fg, rgb_bg;
attr_t color_hint_attrs = vc.attrs_for_role(view_colors::VCR_COLOR_HINT); attr_t color_hint_attrs = vc.attrs_for_role(view_colors::VCR_COLOR_HINT);
int pnum = PAIR_NUMBER(color_hint_attrs); int pnum = PAIR_NUMBER(color_hint_attrs);
if (rgb_color::from_str(hash_color, rgb_bg, errmsg)) { rgb_color::from_str(hash_color).then([&](const auto& rgb_fg) {
pnum -= 1; pnum -= 1;
vc.ensure_color_pair(pnum, rgb_fg, rgb_bg); vc.ensure_color_pair(pnum, rgb_fg, rgb_color{});
al.get_attrs().emplace_back( al.get_attrs().emplace_back(
line_range{cap->c_begin, cap->c_begin + 1}, line_range{cap->c_begin, cap->c_begin + 1},
&view_curses::VC_ROLE, &view_curses::VC_ROLE,
view_colors::VCR_COLOR_HINT); view_colors::VCR_COLOR_HINT);
} });
} }
} }
pi.reset(line); pi.reset(line);

@ -31,6 +31,7 @@
#include <string> #include <string>
#include "fmt/format.h"
#include "yajlpp/yajlpp.hh" #include "yajlpp/yajlpp.hh"
#include "yajlpp/yajlpp_def.hh" #include "yajlpp/yajlpp_def.hh"
#include "styling.hh" #include "styling.hh"
@ -53,6 +54,8 @@ static struct json_path_container term_color_handler = {
.FOR_FIELD(term_color, xc_id), .FOR_FIELD(term_color, xc_id),
yajlpp::property_handler("name") yajlpp::property_handler("name")
.FOR_FIELD(term_color, xc_name), .FOR_FIELD(term_color, xc_name),
yajlpp::property_handler("hexString")
.FOR_FIELD(term_color, xc_hex),
yajlpp::property_handler("rgb") yajlpp::property_handler("rgb")
.with_obj_provider<rgb_color, term_color>( .with_obj_provider<rgb_color, term_color>(
[](const auto &pc, term_color *xc) { return &xc->xc_color; }) [](const auto &pc, term_color *xc) { return &xc->xc_color; })
@ -83,46 +86,46 @@ term_color_palette *ansi_colors()
return &retval; return &retval;
} }
bool rgb_color::from_str(const string_fragment &color, Result<rgb_color, std::string> rgb_color::from_str(const string_fragment &sf)
rgb_color &rgb_out,
std::string &errmsg)
{ {
if (color.empty()) { if (sf.empty()) {
return true; return Ok(rgb_color());
} }
if (color[0] == '#') { rgb_color rgb_out;
switch (color.length()) {
if (sf[0] == '#') {
switch (sf.length()) {
case 4: case 4:
if (sscanf(color.data(), "#%1hx%1hx%1hx", if (sscanf(sf.data(), "#%1hx%1hx%1hx",
&rgb_out.rc_r, &rgb_out.rc_g, &rgb_out.rc_b) == 3) { &rgb_out.rc_r, &rgb_out.rc_g, &rgb_out.rc_b) == 3) {
rgb_out.rc_r |= rgb_out.rc_r << 4; rgb_out.rc_r |= rgb_out.rc_r << 4;
rgb_out.rc_g |= rgb_out.rc_g << 4; rgb_out.rc_g |= rgb_out.rc_g << 4;
rgb_out.rc_b |= rgb_out.rc_b << 4; rgb_out.rc_b |= rgb_out.rc_b << 4;
return true; return Ok(rgb_out);
} }
break; break;
case 7: case 7:
if (sscanf(color.data(), "#%2hx%2hx%2hx", if (sscanf(sf.data(), "#%2hx%2hx%2hx",
&rgb_out.rc_r, &rgb_out.rc_g, &rgb_out.rc_b) == 3) { &rgb_out.rc_r, &rgb_out.rc_g, &rgb_out.rc_b) == 3) {
return true; return Ok(rgb_out);
} }
break; break;
} }
errmsg = "Could not parse color: " + color.to_string();
return false; return Err(fmt::format("Could not parse color: {}", sf));
} }
for (const auto &xc : xterm_colors()->tc_palette) { for (const auto &xc : xterm_colors()->tc_palette) {
if (color.iequal(xc.xc_name)) { if (sf.iequal(xc.xc_name)) {
rgb_out = xc.xc_color; return Ok(xc.xc_color);
return true;
} }
} }
errmsg = "Unknown color: '" + color.to_string() + return Err(fmt::format(
"'. See https://jonasjacek.github.io/colors/ for a list of supported color names"; "Unknown color: '{}'. "
return false; "See https://jonasjacek.github.io/colors/ for a list of supported "
"color names", sf));
} }
bool rgb_color::operator<(const rgb_color &rhs) const bool rgb_color::operator<(const rgb_color &rhs) const

@ -35,12 +35,11 @@
#include <vector> #include <vector>
#include "log_level.hh" #include "log_level.hh"
#include "base/result.h"
#include "base/intern_string.hh" #include "base/intern_string.hh"
struct rgb_color { struct rgb_color {
static bool from_str(const string_fragment &color, static Result<rgb_color, std::string> from_str(const string_fragment &sf);
rgb_color &rgb_out,
std::string &errmsg);
explicit rgb_color(short r = -1, short g = -1, short b = -1) explicit rgb_color(short r = -1, short g = -1, short b = -1)
: rc_r(r), rc_g(g), rc_b(b) { : rc_r(r), rc_g(g), rc_b(b) {
@ -103,6 +102,7 @@ struct lab_color {
struct term_color { struct term_color {
short xc_id; short xc_id;
std::string xc_name; std::string xc_name;
std::string xc_hex;
rgb_color xc_color; rgb_color xc_color;
lab_color xc_lab_color; lab_color xc_lab_color;
}; };

@ -168,7 +168,7 @@ void textview_curses::reload_config(error_reporter &reporter)
const auto &sc = hl_pair.second.hc_style; const auto &sc = hl_pair.second.hc_style;
string fg1, bg1, fg_color, bg_color, errmsg; string fg1, bg1, fg_color, bg_color, errmsg;
rgb_color fg, bg; bool invalid = false;
int attrs = 0; int attrs = 0;
fg1 = sc.sc_color; fg1 = sc.sc_color;
@ -176,12 +176,19 @@ void textview_curses::reload_config(error_reporter &reporter)
shlex(fg1).eval(fg_color, theme_iter->second.lt_vars); shlex(fg1).eval(fg_color, theme_iter->second.lt_vars);
shlex(bg1).eval(bg_color, theme_iter->second.lt_vars); shlex(bg1).eval(bg_color, theme_iter->second.lt_vars);
if (!rgb_color::from_str(fg_color, fg, errmsg)) { auto fg = rgb_color::from_str(fg_color)
reporter(&sc.sc_color, errmsg); .unwrapOrElse([&](const auto& msg) {
continue; reporter(&sc.sc_color, errmsg);
} invalid = true;
if (!rgb_color::from_str(bg_color, bg, errmsg)) { return rgb_color{};
reporter(&sc.sc_background_color, errmsg); });
auto bg = rgb_color::from_str(bg_color)
.unwrapOrElse([&](const auto& msg) {
reporter(&sc.sc_background_color, errmsg);
invalid = true;
return rgb_color{};
});
if (invalid) {
continue; continue;
} }

@ -6,7 +6,7 @@
"styles": { "styles": {
"text": { "text": {
"color": "Silver", "color": "Silver",
"background-color": "" "background-color": "Black"
}, },
"identifier": { "identifier": {
"background-color": "" "background-color": ""
@ -149,6 +149,12 @@
} }
}, },
"highlights": { "highlights": {
"colors": {
"pattern": "(?:#[a-fA-F0-9]{6}|#[a-fA-F0-9]{3})",
"style": {
"semantic": true
}
},
"ipv4": { "ipv4": {
"pattern": "\\b(?<!\\d\\.)\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b(?!\\.\\d)", "pattern": "\\b(?<!\\d\\.)\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b(?!\\.\\d)",
"style": { "style": {

@ -98,6 +98,13 @@ struct utf_to_display_adjustment {
}; };
}; };
void view_curses::awaiting_user_input()
{
static const char OSC_INPUT[] = "\x1b]999;send-input\a";
write(STDOUT_FILENO, OSC_INPUT, sizeof(OSC_INPUT) - 1);
}
void view_curses::mvwattrline(WINDOW *window, void view_curses::mvwattrline(WINDOW *window,
int y, int y,
int x, int x,
@ -423,7 +430,7 @@ void view_colors::init()
{ {
vc_active_palette = ansi_colors(); vc_active_palette = ansi_colors();
if (has_colors()) { if (has_colors()) {
static int ansi_colors_to_curses[] = { static const int ansi_colors_to_curses[] = {
COLOR_BLACK, COLOR_BLACK,
COLOR_RED, COLOR_RED,
COLOR_GREEN, COLOR_GREEN,
@ -443,9 +450,22 @@ void view_colors::init()
for (int bg = 0; bg < 8; bg++) { for (int bg = 0; bg < 8; bg++) {
if (fg == 0 && bg == 0) if (fg == 0 && bg == 0)
continue; continue;
init_pair(ansi_color_pair_index(fg, bg),
ansi_colors_to_curses[fg], if (lnav_config.lc_ui_default_colors &&
ansi_colors_to_curses[bg]); ansi_colors_to_curses[fg] == COLOR_WHITE &&
ansi_colors_to_curses[bg] == COLOR_BLACK) {
init_pair(ansi_color_pair_index(fg, bg), -1, -1);
} else {
auto curs_bg = ansi_colors_to_curses[bg];
if (lnav_config.lc_ui_default_colors &&
curs_bg == COLOR_BLACK) {
curs_bg = -1;
}
init_pair(ansi_color_pair_index(fg, bg),
ansi_colors_to_curses[fg],
curs_bg);
}
} }
} }
if (COLORS >= 256) { if (COLORS >= 256) {
@ -466,6 +486,12 @@ void view_colors::init()
inline attr_t attr_for_colors(int &pair_base, short fg, short bg) inline attr_t attr_for_colors(int &pair_base, short fg, short bg)
{ {
if (fg == -1) {
fg = COLOR_WHITE;
}
if (bg == -1) {
bg = COLOR_BLACK;
}
if (COLOR_PAIRS <= 64) { if (COLOR_PAIRS <= 64) {
return view_colors::ansi_color_pair(fg, bg); return view_colors::ansi_color_pair(fg, bg);
} else { } else {
@ -476,13 +502,6 @@ inline attr_t attr_for_colors(int &pair_base, short fg, short bg)
if (bg == COLOR_BLACK) { if (bg == COLOR_BLACK) {
bg = -1; bg = -1;
} }
} else {
if (fg == -1) {
fg = COLOR_WHITE;
}
if (bg == -1) {
bg = COLOR_BLACK;
}
} }
} }
@ -502,8 +521,7 @@ pair<attr_t, attr_t> view_colors::to_attrs(
const lnav_theme &lt, const style_config &sc, const style_config &fallback_sc, const lnav_theme &lt, const style_config &sc, const style_config &fallback_sc,
lnav_config_listener::error_reporter &reporter) lnav_config_listener::error_reporter &reporter)
{ {
rgb_color fg, bg; string fg1, bg1, fg_color, bg_color;
string fg1, bg1, fg_color, bg_color, errmsg;
fg1 = sc.sc_color; fg1 = sc.sc_color;
if (fg1.empty()) { if (fg1.empty()) {
@ -516,12 +534,14 @@ pair<attr_t, attr_t> view_colors::to_attrs(
shlex(fg1).eval(fg_color, lt.lt_vars); shlex(fg1).eval(fg_color, lt.lt_vars);
shlex(bg1).eval(bg_color, lt.lt_vars); shlex(bg1).eval(bg_color, lt.lt_vars);
if (!rgb_color::from_str(fg_color, fg, errmsg)) { auto fg = rgb_color::from_str(fg_color).unwrapOrElse([&](const auto& msg) {
reporter(&sc.sc_color, errmsg); reporter(&sc.sc_color, msg);
} return rgb_color{};
if (!rgb_color::from_str(bg_color, bg, errmsg)) { });
reporter(&sc.sc_background_color, errmsg); auto bg = rgb_color::from_str(bg_color).unwrapOrElse([&](const auto& msg) {
} reporter(&sc.sc_background_color, msg);
return rgb_color{};
});
attr_t retval1 = attr_for_colors(pair_base, attr_t retval1 = attr_for_colors(pair_base,
this->match_color(fg), this->match_color(fg),
@ -552,13 +572,14 @@ void view_colors::init_roles(const lnav_theme &lt,
int ident_bg = (lnav_config.lc_ui_default_colors ? -1 : COLOR_BLACK); int ident_bg = (lnav_config.lc_ui_default_colors ? -1 : COLOR_BLACK);
if (!ident_sc.sc_background_color.empty()) { if (!ident_sc.sc_background_color.empty()) {
string bg_color, errmsg; string bg_color;
rgb_color rgb_bg;
shlex(ident_sc.sc_background_color).eval(bg_color, lt.lt_vars); shlex(ident_sc.sc_background_color).eval(bg_color, lt.lt_vars);
if (!rgb_color::from_str(bg_color, rgb_bg, errmsg)) { auto rgb_bg = rgb_color::from_str(bg_color)
reporter(&ident_sc.sc_background_color, errmsg); .unwrapOrElse([&](const auto& msg) {
} reporter(&ident_sc.sc_background_color, msg);
return rgb_color{};
});
ident_bg = vc_active_palette->match_color(lab_color(rgb_bg)); ident_bg = vc_active_palette->match_color(lab_color(rgb_bg));
} }
for (int z = 0; z < 6; z++) { for (int z = 0; z < 6; z++) {
@ -592,19 +613,17 @@ void view_colors::init_roles(const lnav_theme &lt,
auto fg_str = lt.lt_vars.find(COLOR_NAMES[ansi_fg]); auto fg_str = lt.lt_vars.find(COLOR_NAMES[ansi_fg]);
auto bg_str = lt.lt_vars.find(COLOR_NAMES[ansi_bg]); auto bg_str = lt.lt_vars.find(COLOR_NAMES[ansi_bg]);
rgb_color rgb_fg, rgb_bg;
string errmsg;
if (fg_str != lt.lt_vars.end() && auto rgb_fg = rgb_color::from_str(fg_str->second)
!rgb_color::from_str(fg_str->second, rgb_fg, errmsg)) { .unwrapOrElse([&](const auto& msg) {
reporter(&fg_str->second, errmsg); reporter(&fg_str->second, msg);
return; return rgb_color{};
} });
if (bg_str != lt.lt_vars.end() && auto rgb_bg = rgb_color::from_str(bg_str->second)
!rgb_color::from_str(bg_str->second, rgb_bg, errmsg)) { .unwrapOrElse([&](const auto& msg) {
reporter(&bg_str->second, errmsg); reporter(&fg_str->second, msg);
return; return rgb_color{};
} });
short fg = vc_active_palette->match_color(lab_color(rgb_fg)); short fg = vc_active_palette->match_color(lab_color(rgb_fg));
short bg = vc_active_palette->match_color(lab_color(rgb_bg)); short bg = vc_active_palette->match_color(lab_color(rgb_bg));
@ -617,6 +636,12 @@ void view_colors::init_roles(const lnav_theme &lt,
} }
this->vc_ansi_to_theme[ansi_fg] = fg; this->vc_ansi_to_theme[ansi_fg] = fg;
if (lnav_config.lc_ui_default_colors && bg == COLOR_BLACK) {
bg = -1;
if (fg == COLOR_WHITE) {
fg = -1;
}
}
init_pair(ansi_color_pair_index(ansi_fg, ansi_bg), fg, bg); init_pair(ansi_color_pair_index(ansi_fg, ansi_bg), fg, bg);
} }
} }
@ -882,7 +907,7 @@ attr_t view_colors::attrs_for_ident(const char *str, size_t len) const
pair_content(pnum, &fg, &bg); pair_content(pnum, &fg, &bg);
} }
else { else {
retval = BASIC_HL_PAIRS[index % BASIC_COLOR_COUNT]; retval = A_BOLD;
} }
return retval; return retval;

@ -442,6 +442,8 @@ public:
static string_attr_type VC_FOREGROUND; static string_attr_type VC_FOREGROUND;
static string_attr_type VC_BACKGROUND; static string_attr_type VC_BACKGROUND;
static void awaiting_user_input();
static void mvwattrline(WINDOW *window, static void mvwattrline(WINDOW *window,
int y, int y,
int x, int x,

@ -62,6 +62,9 @@ add_executable(test_top_status test_top_status.cc)
target_link_libraries(test_top_status diag PkgConfig::libpcre) target_link_libraries(test_top_status diag PkgConfig::libpcre)
add_test(NAME test_top_status COMMAND test_top_status) add_test(NAME test_top_status COMMAND test_top_status)
add_executable(drive_vt52_curses drive_vt52_curses.cc)
target_link_libraries(drive_vt52_curses diag PkgConfig::ncursesw)
add_executable(drive_sql_anno drive_sql_anno.cc) add_executable(drive_sql_anno drive_sql_anno.cc)
target_link_libraries(drive_sql_anno diag PkgConfig::libpcre) target_link_libraries(drive_sql_anno diag PkgConfig::libpcre)

@ -322,6 +322,7 @@ TESTS = \
test_line_buffer.sh \ test_line_buffer.sh \
test_listview.sh \ test_listview.sh \
test_meta.sh \ test_meta.sh \
test_mvwattrline.sh \
test_grep_proc.sh \ test_grep_proc.sh \
test_grep_proc2 \ test_grep_proc2 \
test_json_format.sh \ test_json_format.sh \
@ -342,11 +343,11 @@ TESTS = \
test_sql_xml_func.sh \ test_sql_xml_func.sh \
test_data_parser.sh \ test_data_parser.sh \
test_pretty_print.sh \ test_pretty_print.sh \
test_view_colors.sh \
test_vt52_curses.sh test_vt52_curses.sh
DISABLED_TESTS = \ DISABLED_TESTS = \
test_top_status \ test_top_status
test_view_colors.sh
if HAVE_LIBCURL if HAVE_LIBCURL
TESTS += \ TESTS += \

@ -35,7 +35,6 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include "pcrepp/pcrepp.hh"
#include "textview_curses.hh" #include "textview_curses.hh"
#include "data_scanner.hh" #include "data_scanner.hh"
#include "data_parser.hh" #include "data_parser.hh"

@ -98,15 +98,10 @@ int main(int argc, char *argv[])
tgetstr((char *)"ce", nullptr), tgetstr((char *)"ce", nullptr),
"de", "de",
"\n", "\n",
"1\n", "1",
"2\n", "2",
"3\n", "3",
"4\n", "\n",
"5\n",
"6\n",
"7\n",
"8\n",
"9\n",
"abc", "abc",
"\x02", "\x02",
"\a", "\a",
@ -124,6 +119,7 @@ int main(int argc, char *argv[])
vt.map_output(CANNED_INPUT[lpc], strlen(CANNED_INPUT[lpc])); vt.map_output(CANNED_INPUT[lpc], strlen(CANNED_INPUT[lpc]));
vt.do_update(); vt.do_update();
refresh(); refresh();
view_curses::awaiting_user_input();
getch(); getch();
} }

@ -1 +1,69 @@
read 1b29301b371b5b3f3437681b5b313b3234721b5b6d1b5b346c1b5b481b5b324a48656c6c6f1b5b3734430e780f1b5b323b31480e0f576f726c64211b5b3733430e780f1b5b333b3830480e780f1b5b343b3830480e780f1b5b353b3830480e780f1b5b363b3830480e780f1b5b373b3830480e780f1b5b383b3830480e780f1b5b393b3830480e780f1b5b31303b3830480e780f1b5b31313b3830480e780f1b5b31323b3830480e780f1b5b31333b3830480e780f1b5b31343b3830480e780f1b5b31353b3830480e780f1b5b31363b3830480e780f1b5b31373b3830480e780f1b5b31383b3830480e780f1b5b31393b3830480e780f1b5b32303b3830480e780f1b5b32313b3830480e780f1b5b32323b3830480e780f1b5b32333b3830480e780f1b5b32343b3830480e0f080e780f080e1b5b34680f201b5b346c0d1b5b32343b31481b5b324a1b5b3f34376c1b380d1b5b3f316c1b3e CTRL Use alt charset
CTRL save cursor
CSI Use alternate screen buffer
CSI set scrolling region 1-24
S -1 ┋ ┋
A └ normal
CSI Replace mode
CSI Erase all
S 1 ┋Hello x┋
A └┛ alt
S 2 ┋World! x┋
A └┛ alt
S 3 ┋ x┋
A └┛ alt
S 4 ┋ x┋
A └┛ alt
S 5 ┋ x┋
A └┛ alt
S 6 ┋ x┋
A └┛ alt
S 7 ┋ x┋
A └┛ alt
S 8 ┋ x┋
A └┛ alt
S 9 ┋ x┋
A └┛ alt
S 10 ┋ x┋
A └┛ alt
S 11 ┋ x┋
A └┛ alt
S 12 ┋ x┋
A └┛ alt
S 13 ┋ x┋
A └┛ alt
S 14 ┋ x┋
A └┛ alt
S 15 ┋ x┋
A └┛ alt
S 16 ┋ x┋
A └┛ alt
S 17 ┋ x┋
A └┛ alt
S 18 ┋ x┋
A └┛ alt
S 19 ┋ x┋
A └┛ alt
S 20 ┋ x┋
A └┛ alt
S 21 ┋ x┋
A └┛ alt
S 22 ┋ x┋
A └┛ alt
S 23 ┋ x┋
A └┛ alt
S 24 ┋ ┋
A ···············································································└ backspace
A └┛ alt
A ···············································································└ backspace
A ··············································································└ [4h
CSI Replace mode
S 24 ┋ ┋
A ···············································································└ carriage-return
CSI Erase all
CSI Use normal screen buffer
CTRL restore cursor
S 24 ┋ ┋
A └ carriage-return
CSI Normal cursor keys
CTRL Normal keypad

@ -1 +1,69 @@
read 1b29301b371b5b3f3437681b5b313b3234721b5b6d1b5b346c1b5b481b5b324a576f726c64211b5b3733430e780f1b5b323b3830480e780f1b5b333b3830480e780f1b5b343b3830480e780f1b5b353b3830480e780f1b5b363b3830480e780f1b5b373b3830480e780f1b5b383b3830480e780f1b5b393b3830480e780f1b5b31303b3830480e780f1b5b31313b3830480e780f1b5b31323b3830480e780f1b5b31333b3830480e780f1b5b31343b3830480e780f1b5b31353b3830480e780f1b5b31363b3830480e780f1b5b31373b3830480e780f1b5b31383b3830480e780f1b5b31393b3830480e780f1b5b32303b3830480e780f1b5b32313b3830480e780f1b5b32323b3830480e780f1b5b32333b3830480e780f1b5b32343b3830480e0f080e780f080e1b5b34680f201b5b346c0d1b5b32343b31481b5b324a1b5b3f34376c1b380d1b5b3f316c1b3e CTRL Use alt charset
CTRL save cursor
CSI Use alternate screen buffer
CSI set scrolling region 1-24
S -1 ┋ ┋
A └ normal
CSI Replace mode
CSI Erase all
S 1 ┋World! x┋
A └┛ alt
S 2 ┋ x┋
A └┛ alt
S 3 ┋ x┋
A └┛ alt
S 4 ┋ x┋
A └┛ alt
S 5 ┋ x┋
A └┛ alt
S 6 ┋ x┋
A └┛ alt
S 7 ┋ x┋
A └┛ alt
S 8 ┋ x┋
A └┛ alt
S 9 ┋ x┋
A └┛ alt
S 10 ┋ x┋
A └┛ alt
S 11 ┋ x┋
A └┛ alt
S 12 ┋ x┋
A └┛ alt
S 13 ┋ x┋
A └┛ alt
S 14 ┋ x┋
A └┛ alt
S 15 ┋ x┋
A └┛ alt
S 16 ┋ x┋
A └┛ alt
S 17 ┋ x┋
A └┛ alt
S 18 ┋ x┋
A └┛ alt
S 19 ┋ x┋
A └┛ alt
S 20 ┋ x┋
A └┛ alt
S 21 ┋ x┋
A └┛ alt
S 22 ┋ x┋
A └┛ alt
S 23 ┋ x┋
A └┛ alt
S 24 ┋ ┋
A ···············································································└ backspace
A └┛ alt
A ···············································································└ backspace
A ··············································································└ [4h
CSI Replace mode
S 24 ┋ ┋
A ···············································································└ carriage-return
CSI Erase all
CSI Use normal screen buffer
CTRL restore cursor
S 24 ┋ ┋
A └ carriage-return
CSI Normal cursor keys
CTRL Normal keypad

@ -1 +1,69 @@
read 1b29301b371b5b3f3437681b5b313b3234721b5b6d1b5b346c1b5b481b5b324a656c6c6f1b5b3735430e780f1b5b323b31480e0f6f726c64211b5b3734430e780f1b5b333b3830480e780f1b5b343b3830480e780f1b5b353b3830480e780f1b5b363b3830480e780f1b5b373b3830480e780f1b5b383b3830480e780f1b5b393b3830480e780f1b5b31303b3830480e780f1b5b31313b3830480e780f1b5b31323b3830480e780f1b5b31333b3830480e780f1b5b31343b3830480e780f1b5b31353b3830480e780f1b5b31363b3830480e780f1b5b31373b3830480e780f1b5b31383b3830480e780f1b5b31393b3830480e780f1b5b32303b3830480e780f1b5b32313b3830480e780f1b5b32323b3830480e780f1b5b32333b3830480e780f1b5b32343b3830480e0f080e780f080e1b5b34680f201b5b346c0d1b5b32343b31481b5b324a1b5b3f34376c1b380d1b5b3f316c1b3e CTRL Use alt charset
CTRL save cursor
CSI Use alternate screen buffer
CSI set scrolling region 1-24
S -1 ┋ ┋
A └ normal
CSI Replace mode
CSI Erase all
S 1 ┋ello x┋
A └┛ alt
S 2 ┋orld! x┋
A └┛ alt
S 3 ┋ x┋
A └┛ alt
S 4 ┋ x┋
A └┛ alt
S 5 ┋ x┋
A └┛ alt
S 6 ┋ x┋
A └┛ alt
S 7 ┋ x┋
A └┛ alt
S 8 ┋ x┋
A └┛ alt
S 9 ┋ x┋
A └┛ alt
S 10 ┋ x┋
A └┛ alt
S 11 ┋ x┋
A └┛ alt
S 12 ┋ x┋
A └┛ alt
S 13 ┋ x┋
A └┛ alt
S 14 ┋ x┋
A └┛ alt
S 15 ┋ x┋
A └┛ alt
S 16 ┋ x┋
A └┛ alt
S 17 ┋ x┋
A └┛ alt
S 18 ┋ x┋
A └┛ alt
S 19 ┋ x┋
A └┛ alt
S 20 ┋ x┋
A └┛ alt
S 21 ┋ x┋
A └┛ alt
S 22 ┋ x┋
A └┛ alt
S 23 ┋ x┋
A └┛ alt
S 24 ┋ ┋
A ···············································································└ backspace
A └┛ alt
A ···············································································└ backspace
A ··············································································└ [4h
CSI Replace mode
S 24 ┋ ┋
A ···············································································└ carriage-return
CSI Erase all
CSI Use normal screen buffer
CTRL restore cursor
S 24 ┋ ┋
A └ carriage-return
CSI Normal cursor keys
CTRL Normal keypad

@ -1 +1,69 @@
read 1b29301b371b5b3f3437681b5b313b3234721b5b6d1b5b346c1b5b481b5b324a6f726c64211b5b3734430e780f1b5b323b3830480e780f1b5b333b3830480e780f1b5b343b3830480e780f1b5b353b3830480e780f1b5b363b3830480e780f1b5b373b3830480e780f1b5b383b3830480e780f1b5b393b3830480e780f1b5b31303b3830480e780f1b5b31313b3830480e780f1b5b31323b3830480e780f1b5b31333b3830480e780f1b5b31343b3830480e780f1b5b31353b3830480e780f1b5b31363b3830480e780f1b5b31373b3830480e780f1b5b31383b3830480e780f1b5b31393b3830480e780f1b5b32303b3830480e780f1b5b32313b3830480e780f1b5b32323b3830480e780f1b5b32333b3830480e780f1b5b32343b3830480e0f080e780f080e1b5b34680f201b5b346c0d1b5b32343b31481b5b324a1b5b3f34376c1b380d1b5b3f316c1b3e CTRL Use alt charset
CTRL save cursor
CSI Use alternate screen buffer
CSI set scrolling region 1-24
S -1 ┋ ┋
A └ normal
CSI Replace mode
CSI Erase all
S 1 ┋orld! x┋
A └┛ alt
S 2 ┋ x┋
A └┛ alt
S 3 ┋ x┋
A └┛ alt
S 4 ┋ x┋
A └┛ alt
S 5 ┋ x┋
A └┛ alt
S 6 ┋ x┋
A └┛ alt
S 7 ┋ x┋
A └┛ alt
S 8 ┋ x┋
A └┛ alt
S 9 ┋ x┋
A └┛ alt
S 10 ┋ x┋
A └┛ alt
S 11 ┋ x┋
A └┛ alt
S 12 ┋ x┋
A └┛ alt
S 13 ┋ x┋
A └┛ alt
S 14 ┋ x┋
A └┛ alt
S 15 ┋ x┋
A └┛ alt
S 16 ┋ x┋
A └┛ alt
S 17 ┋ x┋
A └┛ alt
S 18 ┋ x┋
A └┛ alt
S 19 ┋ x┋
A └┛ alt
S 20 ┋ x┋
A └┛ alt
S 21 ┋ x┋
A └┛ alt
S 22 ┋ x┋
A └┛ alt
S 23 ┋ x┋
A └┛ alt
S 24 ┋ ┋
A ···············································································└ backspace
A └┛ alt
A ···············································································└ backspace
A ··············································································└ [4h
CSI Replace mode
S 24 ┋ ┋
A ···············································································└ carriage-return
CSI Erase all
CSI Use normal screen buffer
CTRL restore cursor
S 24 ┋ ┋
A └ carriage-return
CSI Normal cursor keys
CTRL Normal keypad

@ -1 +1,67 @@
read 1b29301b371b5b3f3437681b5b313b3234721b5b6d1b5b346c1b5b481b5b324a0a48656c6c6f1b5b3734430e780f1b5b333b31480e0f576f726c64211b5b3733430e780f1b5b343b31480e0f321b5b3738430e780f1b5b353b31480e0f331b5b3738430e780f1b5b363b31480e0f341b5b3738430e780f1b5b373b31480e0f351b5b3738430e780f1b5b383b31480e0f361b5b3738430e780f1b5b393b31480e0f371b5b3738430e780f1b5b31303b31480e0f381b5b3738430e780f1b5b31313b31480e0f391b5b3738430e780f1b5b31323b31480e0f31301b5b3737430e780f1b5b31333b31480e0f31311b5b3737430e780f1b5b31343b31480e0f31321b5b3737430e780f1b5b31353b31480e0f31331b5b3737430e780f1b5b31363b31480e0f31341b5b3737430e780f1b5b31373b31480e0f31351b5b3737430e780f1b5b31383b31480e0f31361b5b3737430e780f1b5b31393b31480e0f31371b5b3737430e780f1b5b32303b31480e0f31381b5b3737430e780f1b5b32313b31480e0f31391b5b3737430e780f1b5b32323b31480e0f32301b5b3737430e780f1b5b32333b31480e0f32311b5b3737430e780f1b5b32343b31480e0f32321b5b373743080e780f080e1b5b34680f201b5b346c0d1b5b32343b31481b5b324a1b5b3f34376c1b380d1b5b3f316c1b3e CTRL Use alt charset
CTRL save cursor
CSI Use alternate screen buffer
CSI set scrolling region 1-24
S -1 ┋ ┋
A └ normal
CSI Replace mode
CSI Erase all
S 2 ┋Hello x┋
A └┛ alt
S 3 ┋World! x┋
A └┛ alt
S 4 ┋2 x┋
A └┛ alt
S 5 ┋3 x┋
A └┛ alt
S 6 ┋4 x┋
A └┛ alt
S 7 ┋5 x┋
A └┛ alt
S 8 ┋6 x┋
A └┛ alt
S 9 ┋7 x┋
A └┛ alt
S 10 ┋8 x┋
A └┛ alt
S 11 ┋9 x┋
A └┛ alt
S 12 ┋10 x┋
A └┛ alt
S 13 ┋11 x┋
A └┛ alt
S 14 ┋12 x┋
A └┛ alt
S 15 ┋13 x┋
A └┛ alt
S 16 ┋14 x┋
A └┛ alt
S 17 ┋15 x┋
A └┛ alt
S 18 ┋16 x┋
A └┛ alt
S 19 ┋17 x┋
A └┛ alt
S 20 ┋18 x┋
A └┛ alt
S 21 ┋19 x┋
A └┛ alt
S 22 ┋20 x┋
A └┛ alt
S 23 ┋21 x┋
A └┛ alt
S 24 ┋22 ┋
A ···············································································└ backspace
A └┛ alt
A ···············································································└ backspace
A ··············································································└ [4h
CSI Replace mode
S 24 ┋ ┋
A ···············································································└ carriage-return
CSI Erase all
CSI Use normal screen buffer
CTRL restore cursor
S 24 ┋ ┋
A └ carriage-return
CSI Normal cursor keys
CTRL Normal keypad

@ -1 +1,59 @@
read 1b29301b371b5b3f3437681b5b313b3234721b5b6d1b5b346c1b5b481b5b324a0a48656c6c6f1b5b3734430e780f1b5b333b31480e0f576f726c64211b5b3733430e780f1b5b343b31480e0f321b5b3738430e780f1b5b353b31480e0f331b5b3738430e780f1b5b363b31480e0f341b5b3738430e780f1b5b373b31480e0f351b5b3738430e780f1b5b383b31480e0f361b5b3738430e780f1b5b393b31480e0f371b5b3738430e780f1b5b31303b31480e0f381b5b3738430e780f1b5b31313b31480e0f391b5b3738430e780f1b5b31323b31480e0f31301b5b3737430e780f1b5b31333b31480e0f31311b5b3737430e780f1b5b31343b31480e0f31321b5b3737430e780f1b5b31353b31480e0f31331b5b3737430e780f1b5b31363b31480e0f31341b5b3737430e780f1b5b31373b31480e0f31351b5b3737430e780f1b5b31383b31480e0f31361b5b3737430e780f1b5b31393b31480e0f31371b5b3737430e780f1b5b32303b31480e0f31381b5b3737430e780f1b5b32313b31480e0f31391b5b3737430e780f1b5b32323b31480e0f32301b5b3737430e780f1b5b32333b31480e0f32311b5b3737430e780f1b5b32333b31480e0f1b5b32343b31481b5b324a1b5b3f34376c1b380d1b5b3f316c1b3e CTRL Use alt charset
CTRL save cursor
CSI Use alternate screen buffer
CSI set scrolling region 1-24
S -1 ┋ ┋
A └ normal
CSI Replace mode
CSI Erase all
S 2 ┋Hello x┋
A └┛ alt
S 3 ┋World! x┋
A └┛ alt
S 4 ┋2 x┋
A └┛ alt
S 5 ┋3 x┋
A └┛ alt
S 6 ┋4 x┋
A └┛ alt
S 7 ┋5 x┋
A └┛ alt
S 8 ┋6 x┋
A └┛ alt
S 9 ┋7 x┋
A └┛ alt
S 10 ┋8 x┋
A └┛ alt
S 11 ┋9 x┋
A └┛ alt
S 12 ┋10 x┋
A └┛ alt
S 13 ┋11 x┋
A └┛ alt
S 14 ┋12 x┋
A └┛ alt
S 15 ┋13 x┋
A └┛ alt
S 16 ┋14 x┋
A └┛ alt
S 17 ┋15 x┋
A └┛ alt
S 18 ┋16 x┋
A └┛ alt
S 19 ┋17 x┋
A └┛ alt
S 20 ┋18 x┋
A └┛ alt
S 21 ┋19 x┋
A └┛ alt
S 22 ┋20 x┋
A └┛ alt
S 23 ┋21 x┋
A └┛ alt
CSI Erase all
CSI Use normal screen buffer
CTRL restore cursor
S 24 ┋ ┋
A └ carriage-return
CSI Normal cursor keys
CTRL Normal keypad

@ -1 +1,59 @@
read 1b29301b371b5b3f3437681b5b313b3234721b5b6d1b5b346c1b5b481b5b324a0a576f726c64211b5b3733430e780f1b5b333b31480e0f321b5b3738430e780f1b5b343b31480e0f331b5b3738430e780f1b5b353b31480e0f341b5b3738430e780f1b5b363b31480e0f351b5b3738430e780f1b5b373b31480e0f361b5b3738430e780f1b5b383b31480e0f371b5b3738430e780f1b5b393b31480e0f381b5b3738430e780f1b5b31303b31480e0f391b5b3738430e780f1b5b31313b31480e0f31301b5b3737430e780f1b5b31323b31480e0f31311b5b3737430e780f1b5b31333b31480e0f31321b5b3737430e780f1b5b31343b31480e0f31331b5b3737430e780f1b5b31353b31480e0f31341b5b3737430e780f1b5b31363b31480e0f31351b5b3737430e780f1b5b31373b31480e0f31361b5b3737430e780f1b5b31383b31480e0f31371b5b3737430e780f1b5b31393b31480e0f31381b5b3737430e780f1b5b32303b31480e0f31391b5b3737430e780f1b5b32313b31480e0f32301b5b3737430e780f1b5b32323b31480e0f32311b5b3737430e780f1b5b32333b31480e0f32321b5b3737430e780f1b5b32333b31480e0f1b5b32343b31481b5b324a1b5b3f34376c1b380d1b5b3f316c1b3e CTRL Use alt charset
CTRL save cursor
CSI Use alternate screen buffer
CSI set scrolling region 1-24
S -1 ┋ ┋
A └ normal
CSI Replace mode
CSI Erase all
S 2 ┋World! x┋
A └┛ alt
S 3 ┋2 x┋
A └┛ alt
S 4 ┋3 x┋
A └┛ alt
S 5 ┋4 x┋
A └┛ alt
S 6 ┋5 x┋
A └┛ alt
S 7 ┋6 x┋
A └┛ alt
S 8 ┋7 x┋
A └┛ alt
S 9 ┋8 x┋
A └┛ alt
S 10 ┋9 x┋
A └┛ alt
S 11 ┋10 x┋
A └┛ alt
S 12 ┋11 x┋
A └┛ alt
S 13 ┋12 x┋
A └┛ alt
S 14 ┋13 x┋
A └┛ alt
S 15 ┋14 x┋
A └┛ alt
S 16 ┋15 x┋
A └┛ alt
S 17 ┋16 x┋
A └┛ alt
S 18 ┋17 x┋
A └┛ alt
S 19 ┋18 x┋
A └┛ alt
S 20 ┋19 x┋
A └┛ alt
S 21 ┋20 x┋
A └┛ alt
S 22 ┋21 x┋
A └┛ alt
S 23 ┋22 x┋
A └┛ alt
CSI Erase all
CSI Use normal screen buffer
CTRL restore cursor
S 24 ┋ ┋
A └ carriage-return
CSI Normal cursor keys
CTRL Normal keypad

@ -115,12 +115,7 @@ TEST_CASE("ptime_fmt") {
TEST_CASE("rgb_color from string") { TEST_CASE("rgb_color from string") {
string name = "SkyBlue1"; string name = "SkyBlue1";
rgb_color color; auto color = rgb_color::from_str(name).unwrap();
string errmsg;
bool rc;
rc = rgb_color::from_str(name, color, errmsg);
CHECK(rc);
CHECK(color.rc_r == 135); CHECK(color.rc_r == 135);
CHECK(color.rc_g == 215); CHECK(color.rc_g == 215);
CHECK(color.rc_b == 255); CHECK(color.rc_b == 255);

@ -1 +1,49 @@
read 1b29301b371b5b3f3437681b5b313b3234721b5b6d1b5b346c1b5b6d1b5b6d1b5b33376d1b5b34306d1b5b313b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b323b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b333b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b343b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b353b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b363b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b373b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b383b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b393b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b31303b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b31313b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b31323b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b31333b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b31343b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b31353b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b31363b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b31373b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b31383b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b31393b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b32303b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b32313b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b32323b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b32333b314820202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020201b5b32343b3148202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020200820081b5b3468201b5b346c1b5b481b5b33376d1b5b34306d506c61696e20746578740d0a1b5b376d20202020202020201b5b6d1b5b33376d1b5b34306d4c656164696e67207461620d0a541b5b376d616220202020201b5b6d1b5b33376d1b5b34306d7769746820746578740d0a5461621b5b376d20202020201b5b6d1b5b33376d1b5b34306d7769746820746578742023320d0a54657874201b5b33316d1b5b34306d77691b5b376d74681b5b33376d1b5b34306d206d691b5b6d1b5b33376d1b5b34306d78656420617474726962757465732e0d0a54657874207769746820756e69636f646520ffffffe2ffffff96ffffffb6201b5b376d636861721b5b6d1b5b33376d1b5b34306d6163746572730d0a1b5b6d1b5b6d1b5b33376d1b5b34306d1b5b6d1b5b3137421b5b4b1b5b32343b31481b5b324a1b5b3f34376c1b380d1b5b3f316c1b3e CTRL Use alt charset
CTRL save cursor
CSI Use alternate screen buffer
CSI set scrolling region 1-24
S -1 ┋ ┋
A └ normal
CSI Replace mode
S -1 ┋ ┋
A └ normal, normal, normal
CSI Erase all
S 1 ┋Plain text ┋
A ··········└ carriage-return
S 2 ┋ Leading tab ┋
A └ inverse │
A ········└ normal │
A ···················└ carriage-return
S 3 ┋Tab with text ┋
A ·└ inverse │
A ········└ normal │
A ·················└ carriage-return
S 4 ┋Tab with text #2 ┋
A ···└ inverse │
A ········└ normal │
A ····················└ carriage-return
S 5 ┋Two tabs with text ┋
A ········└ inverse │ │
A ··········└ normal │ │
A ················└ inverse│
A ····················└ normal
A ·························└ carriage-return
S 6 ┋Text with mixed attributes. ┋
A ·····└ fg(#800000) │
A ·······└ inverse │
A ·········└ normal │
A ············└ normal │
A ···························└ carriage-return
S 7 ┋Text with unicode ▶ characters ┋
A ····················└ inverse │
A ························└ normal
A ······························└ carriage-return
S 8 ┋ ┋
A └ normal
CSI Erase all
CSI Use normal screen buffer
CTRL restore cursor
S 24 ┋ ┋
A └ carriage-return
CSI Normal cursor keys
CTRL Normal keypad

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
#! /bin/bash #! /bin/bash
run_test ./scripty -n -r ${srcdir}/vt52_curses_input.0 \ run_test ./scripty -n -e ${srcdir}/vt52_curses_input.0 \
-e ${srcdir}/vt52_curses_output.0 -- ./drive_vt52_curses < /dev/null -- ./drive_vt52_curses < /dev/null
on_error_fail_with "single line vt52 did not work?" on_error_fail_with "single line vt52 did not work?"

File diff suppressed because one or more lines are too long

@ -1,38 +1,48 @@
sleep 0.867286 CTRL Use alt charset
write 0d CTRL save cursor
sleep 0.141596 CSI Use alternate screen buffer
write 0d CSI set scrolling region 1-24
sleep 0.188837 S -1 ┋ ┋
write 0d A └ normal
sleep 0.177586 CSI Replace mode
write 0d CSI Erase all
sleep 0.159950 S 1 ┋Gruß ┋
write 0d K 0d
sleep 0.158958 S 1 ┋ ┋
write 0d A ····└ carriage-return
sleep 0.164105 K 0d
write 0d CSI Erase Below
sleep 0.176968 K 0d
write 0d S 1 ┋de ┋
sleep 0.165942 K 0d
write 0d S 1 ┋ ┋
sleep 0.187011 A ··└ carriage-return
write 0d CSI Erase Below
sleep 0.167987 K 0d
write 0d S 1 ┋1 ┋
sleep 0.173959 K 0d
write 0d S 1 ┋ 2 ┋
sleep 0.176091 K 0d
write 0d S 1 ┋ 3 ┋
sleep 0.180728 K 0d
write 0d S 1 ┋ ┋
sleep 0.172983 A ···└ carriage-return
write 0d CSI Erase Below
sleep 0.167819 K 0d
write 0d S 1 ┋abc ┋
sleep 0.165876 K 0d
write 0d S 1 ┋ ┋
sleep 0.175857 A ···└ carriage-return
write 0d CSI Erase Below
sleep 0.183068 K 0d
write 0d CTRL bell
K 0d
S 1 ┋acdef ┋
K 0d0d
CSI Erase all
CSI Use normal screen buffer
CTRL restore cursor
S 24 ┋ ┋
A └ carriage-return
CSI Normal cursor keys
CTRL Normal keypad

Loading…
Cancel
Save