Compare commits

...

3 Commits

Author SHA1 Message Date
4ed6693f57
xC: erase remaining mentions of a "backlog helper" 2022-08-29 08:22:09 +02:00
bea8d13227
xC: don't autosave when nothing changed 2022-08-29 08:22:09 +02:00
ecebeace0e
Don't wrap xD-gen-replies in a shell script
AWK doesn't seem to be that friendly to shebangs, so let env,
also required for changing LC_ALL, locate it in PATH.
2022-08-29 06:07:49 +02:00
5 changed files with 49 additions and 45 deletions

View File

@ -148,7 +148,7 @@ include_directories (${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR})
# Generate IRC replies--we need a custom target because of the multiple outputs
add_custom_command (OUTPUT xD-replies.c xD.msg
COMMAND ${PROJECT_SOURCE_DIR}/xD-gen-replies.sh
COMMAND env LC_ALL=C awk -f ${PROJECT_SOURCE_DIR}/xD-gen-replies.awk
> xD-replies.c < ${PROJECT_SOURCE_DIR}/xD-replies
DEPENDS ${PROJECT_SOURCE_DIR}/xD-replies
COMMENT "Generating files from the list of server numerics")

View File

@ -62,10 +62,10 @@ their respective function names:
*M-a*: *goto-activity*::
Go to the first following buffer with unseen activity.
*PageUp*: *display-backlog*::
Show the in-memory backlog for this buffer in the backlog helper,
Show the in-memory backlog for this buffer using *general.pager*,
which is almost certainly the *less*(1) program.
*M-h*: *display-full-log*::
Show the log file for this buffer in the backlog helper.
Show the log file for this buffer using *general.pager*.
*M-H*: *toggle-unimportant*::
Hide all join, part and quit messages, as well as all channel mode changes
that only relate to user channel modes. Intended to reduce noise in

31
xC.c
View File

@ -2879,7 +2879,7 @@ attr_printer_tputs (struct attr_printer *self, const char *attr)
tputs (attr, 1, printer);
else
// We shouldn't really do this but we need it to output formatting
// to the backlog helper--it should be SGR-only
// to the pager--it should be SGR-only
attr_printer_filtered_puts (self->stream, attr);
}
@ -11361,7 +11361,7 @@ handle_command_set_modify
return result;
}
static void
static bool
handle_command_set_assign_item (struct app_context *ctx,
char *key, struct config_item *new_, bool add, bool remove)
{
@ -11384,14 +11384,14 @@ handle_command_set_assign_item (struct app_context *ctx,
log_global_error (ctx,
"Failed to set option \"#s\": #s", key, e->message);
error_free (e);
return false;
}
else
{
struct strv tmp = strv_make ();
dump_matching_options (ctx->config.root, key, &tmp);
log_global_status (ctx, "Option changed: #s", tmp.vector[0]);
strv_free (&tmp);
}
struct strv tmp = strv_make ();
dump_matching_options (ctx->config.root, key, &tmp);
log_global_status (ctx, "Option changed: #s", tmp.vector[0]);
strv_free (&tmp);
return true;
}
static bool
@ -11427,15 +11427,18 @@ handle_command_set_assign
config_item_destroy (new_);
return true;
}
bool changed = false;
for (size_t i = 0; i < all->len; i++)
{
char *key = cstr_cut_until (all->vector[i], " ");
handle_command_set_assign_item (ctx, key, new_, add, remove);
if (handle_command_set_assign_item (ctx, key, new_, add, remove))
changed = true;
free (key);
}
config_item_destroy (new_);
if (get_config_boolean (ctx->config.root, "general.autosave"))
if (changed && get_config_boolean (ctx->config.root, "general.autosave"))
save_configuration (ctx);
return true;
}
@ -13166,7 +13169,7 @@ toggle_bracketed_paste (bool enable)
static void
suspend_terminal (struct app_context *ctx)
{
// Terminal can get suspended by both backlog helper and SIGTSTP handling
// Terminal can get suspended by both the pager and SIGTSTP handling
if (ctx->terminal_suspended++ > 0)
return;
@ -14171,8 +14174,8 @@ setup_signal_handlers (void)
signal (SIGPIPE, SIG_IGN);
// So that we can write to the terminal while we're running a backlog
// helper. This is also inherited by the child so that it doesn't stop
// So that we can write to the terminal while we're running a pager.
// This is also inherited by the child so that it doesn't stop
// when it calls tcsetpgrp().
signal (SIGTTOU, SIG_IGN);

29
xD-gen-replies.awk Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/awk -f
BEGIN {
# The message catalog is a by-product
msg = "xD.msg"
print "$quote \"" > msg;
print "$set 1" > msg;
}
/^[0-9]+ *IRC_(ERR|RPL)_[A-Z]+ *".*"$/ {
match($0, /".*"/);
ids[$1] = $2;
texts[$2] = substr($0, RSTART, RLENGTH);
print $1 " " texts[$2] > msg
}
END {
printf("enum\n{")
for (i in ids) {
if (seen_first)
printf(",")
seen_first = 1
printf("\n\t%s = %s", ids[i], i)
}
print "\n};\n"
print "static const char *g_default_replies[] =\n{"
for (i in ids)
print "\t[" ids[i] "] = " texts[ids[i]] ","
print "};"
}

View File

@ -1,28 +0,0 @@
#!/bin/sh
LC_ALL=C exec awk '
BEGIN {
# The message catalog is a by-product
msg = "xD.msg"
print "$quote \"" > msg;
print "$set 1" > msg;
}
/^[0-9]+ *IRC_(ERR|RPL)_[A-Z]+ *".*"$/ {
match($0, /".*"/);
ids[$1] = $2;
texts[$2] = substr($0, RSTART, RLENGTH);
print $1 " " texts[$2] > msg
}
END {
printf("enum\n{")
for (i in ids) {
if (seen_first)
printf(",")
seen_first = 1
printf("\n\t%s = %s", ids[i], i)
}
print "\n};\n"
print "static const char *g_default_replies[] =\n{"
for (i in ids)
print "\t[" ids[i] "] = " texts[ids[i]] ","
print "};"
}'