diff options
| -rw-r--r-- | .gitmodules | 2 | ||||
| m--------- | contrib/scinterm | 0 | ||||
| -rw-r--r-- | lib/colors/terminal.tes | 1 | ||||
| -rw-r--r-- | lib/opener.tes | 5 | ||||
| -rw-r--r-- | lib/tank.tes | 4 | ||||
| -rw-r--r-- | src/interface-curses/interface.c | 6 | ||||
| -rw-r--r-- | src/interface.h | 5 | ||||
| -rw-r--r-- | src/stdio-commands.c | 34 | ||||
| -rw-r--r-- | src/view.c | 4 | ||||
| -rw-r--r-- | tests/testsuite.at | 10 |
10 files changed, 54 insertions, 17 deletions
diff --git a/.gitmodules b/.gitmodules index 841ce77..af9fd68 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,7 +4,7 @@ ignore = untracked [submodule "scinterm"] path = contrib/scinterm - url = https://github.com/orbitalquark/scinterm.git + url = https://github.com/rhaberkorn/scinterm.git [submodule "lexilla"] path = contrib/lexilla url = https://github.com/ScintillaOrg/lexilla.git diff --git a/contrib/scinterm b/contrib/scinterm -Subproject 7f5b0e2bdfb23a2806ed0cf9c6d25c1f37c0392 +Subproject 70691faf4242525cad987da11a7c4912d800691 diff --git a/lib/colors/terminal.tes b/lib/colors/terminal.tes index ea048aa..39c5bac 100644 --- a/lib/colors/terminal.tes +++ b/lib/colors/terminal.tes @@ -9,6 +9,7 @@ Q[color.white]U[color.selback] !* Also used for popups *! [color.calltip] 0,Q[color.lwhite],Q[color.black] +!* Due to the bold attribute this should be grey even on 8-color terminals *! [color.comment] 1,Q[color.black],Q[color.lblack] [color.number] 0,Q[color.black],Q[color.cyan] [color.keyword] 1,Q[color.black],Q[color.lwhite] diff --git a/lib/opener.tes b/lib/opener.tes index 59af79a..8bcd896 100644 --- a/lib/opener.tes +++ b/lib/opener.tes @@ -48,9 +48,6 @@ EQ.f G* I# R <-A"I 1; ' :R;> I# - 1:EN*Q.f"S - !* FIXME: log as a true warning once supports it *! - Warning: Detected recovery file "Q.f"^J - ' + 1:EN*Q.f"S 2Detected recovery file "Q.f" ' ]* } diff --git a/lib/tank.tes b/lib/tank.tes index 8573e22..0894009 100644 --- a/lib/tank.tes +++ b/lib/tank.tes @@ -125,7 +125,7 @@ > M[tank.explode] - %[tank.score] SCORE: \[tank.score] + %[tank.score] 1SCORE: \[tank.score] } @[tank.selfdestruct]{ @@ -170,7 +170,7 @@ ESGETTABDRAWMODE-2"N > ' -CONTROL: W A S D. SHOOT: SPACE. QUIT: ESCAPE. PRESS ANY KEY TO START. +1CONTROL: W A S D. SHOOT: SPACE. QUIT: ESCAPE. PRESS ANY KEY TO START. ESGETCARETSTYLEU.[caretstyle] 0ESSETCARETSTYLE diff --git a/src/interface-curses/interface.c b/src/interface-curses/interface.c index 569b13a..b30e5dc 100644 --- a/src/interface-curses/interface.c +++ b/src/interface-curses/interface.c @@ -156,6 +156,12 @@ static inline gboolean teco_interface_check_key(gint key); * The 8 bright colors (if terminal supports at * least 16 colors), else they are identical to * the non-bright colors (default curses colors). + * + * As a consequence a light black (grey) foreground + * on black background might be invisible on 8 color + * terminals. + * If you add in A_BOLD, there is a good chance that + * the text will still become grey. */ #define COLOR_LBLACK COLOR_LIGHT(COLOR_BLACK) #define COLOR_LRED COLOR_LIGHT(COLOR_RED) diff --git a/src/interface.h b/src/interface.h index 54f807b..3ee8742 100644 --- a/src/interface.h +++ b/src/interface.h @@ -60,10 +60,11 @@ GOptionGroup *teco_interface_get_options(void); void teco_interface_init_color(guint color, guint32 rgb); typedef enum { - TECO_MSG_USER, + TECO_MSG_USER = 0, TECO_MSG_INFO, TECO_MSG_WARNING, - TECO_MSG_ERROR + TECO_MSG_ERROR, + TECO_MSG_MAX = TECO_MSG_ERROR } teco_msg_t; extern teco_msg_t teco_interface_msg_level; diff --git a/src/stdio-commands.c b/src/stdio-commands.c index abb6566..123d0ea 100644 --- a/src/stdio-commands.c +++ b/src/stdio-commands.c @@ -255,17 +255,39 @@ teco_state_print_string_initial(teco_machine_main_t *ctx, GError **error) static teco_state_t * teco_state_print_string_done(teco_machine_main_t *ctx, teco_string_t str, GError **error) { - teco_interface_msg_literal(TECO_MSG_USER, str.data, str.len); + teco_int_t type; + + if (!teco_expressions_pop_num_calc(&type, TECO_MSG_USER, error)) + return NULL; + if (type < TECO_MSG_USER || type > TECO_MSG_MAX) { + g_set_error_literal(error, TECO_ERROR, TECO_ERROR_FAILED, + "Invalid message level specified for <^A>"); + return NULL; + } + + teco_interface_msg_literal(type, str.data, str.len); return &teco_state_start; } /*$ "^A" ":^A" print "print string" - * ^A<string>^A -- Print string as message - * @^A/string/ - * :^A<string>^A + * [type]^A<string>^A -- Print string as message + * [type]@^A/string/ + * [type]:^A<string>^A * - * Print <string> as a message, i.e. in the message line - * in interactive mode and if possible on the terminal (stdout) as well. + * Print <string> as a message with severity <type>, i.e. in the + * message line in interactive mode and if possible on the terminal + * as well. + * The following message levels are supported: + * .IP 0: 3 + * User-level message: + * They are written without any prefixes directly to stdout. + * This is the default if <type> is omitted. + * .IP 1: + * Info-level message + * .IP 2: + * Warnings + * .IP 3: + * Errors * * \fB^A\fP differs from all other commands in the way <string> * is terminated. @@ -112,9 +112,9 @@ teco_view_setup(teco_view_t *ctx) teco_view_ssm(ctx, SCI_SETCARETFORE, 0xFFFFFF, 0); teco_view_ssm(ctx, SCI_SETSELFORE, TRUE, 0x000000); - teco_view_ssm(ctx, SCI_SETSELBACK, TRUE, 0xFFFFFF); + teco_view_ssm(ctx, SCI_SETSELBACK, TRUE, 0xC0C0C0); - teco_view_ssm(ctx, SCI_STYLESETFORE, STYLE_DEFAULT, 0xFFFFFF); + teco_view_ssm(ctx, SCI_STYLESETFORE, STYLE_DEFAULT, 0xC0C0C0); teco_view_ssm(ctx, SCI_STYLESETBACK, STYLE_DEFAULT, 0x000000); teco_view_ssm(ctx, SCI_STYLESETFONT, STYLE_DEFAULT, (sptr_t)"Monospace"); teco_view_ssm(ctx, SCI_STYLECLEARALL, 0, 0); diff --git a/tests/testsuite.at b/tests/testsuite.at index 6bc33e4..a236149 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -221,6 +221,16 @@ AT_DATA([expout], [[TEST Line 2 ]]) TE_CHECK([[@^A/TEST^JLine 2^J/]], 0, expout, ignore) +# FIXME: "Info" messages are surpressed by --quiet. +#AT_DATA([expout], [[Info: TEST +#]]) +#TE_CHECK([[1@^A/TEST/]], 0, expout, ignore) +AT_DATA([experr], [[Warning: TEST +]]) +TE_CHECK([[2@^A/TEST/]], 0, ignore, experr) +AT_DATA([experr], [[Error: TEST +]]) +TE_CHECK([[3@^A/TEST/]], 0, ignore, experr) AT_CLEANUP AT_SETUP([Type out buffer contents]) |
