summaryrefslogtreecommitdiff
path: root/src/fe-common
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-03-10 14:55:46 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-03-10 14:55:46 +0000
commitca234bdf5e88778e4cf569d3bb6d82b26c44163d (patch)
treeb5af283c08724b8f96e186ab997c08f838f623f1 /src/fe-common
parent418678bc95ddf388368978ebddc0776439c788f0 (diff)
downloadirssi-ca234bdf5e88778e4cf569d3bb6d82b26c44163d.zip
*** empty log message ***
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2553 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common')
-rw-r--r--src/fe-common/core/formats.c25
-rw-r--r--src/fe-common/core/formats.h3
-rw-r--r--src/fe-common/core/keyboard.c2
-rw-r--r--src/fe-common/core/printtext.c16
-rw-r--r--src/fe-common/core/themes.c2
-rw-r--r--src/fe-common/core/themes.h3
6 files changed, 44 insertions, 7 deletions
diff --git a/src/fe-common/core/formats.c b/src/fe-common/core/formats.c
index d70bcc45..b91bc0ee 100644
--- a/src/fe-common/core/formats.c
+++ b/src/fe-common/core/formats.c
@@ -549,6 +549,31 @@ char *format_add_linestart(const char *text, const char *linestart)
return ret;
}
+char *format_add_lineend(const char *text, const char *linestart)
+{
+ GString *str;
+ char *ret;
+
+ if (linestart == NULL)
+ return g_strdup(text);
+
+ if (strchr(text, '\n') == NULL)
+ return g_strconcat(text, linestart, NULL);
+
+ str = g_string_new(NULL);
+ while (*text != '\0') {
+ if (*text == '\n')
+ g_string_append(str, linestart);
+ g_string_append_c(str, *text);
+ text++;
+ }
+ g_string_append(str, linestart);
+
+ ret = str->str;
+ g_string_free(str, FALSE);
+ return ret;
+}
+
#define LINE_START_IRSSI_LEVEL \
(MSGLEVEL_CLIENTERROR | MSGLEVEL_CLIENTNOTICE)
diff --git a/src/fe-common/core/formats.h b/src/fe-common/core/formats.h
index b98d7be7..4d459c1c 100644
--- a/src/fe-common/core/formats.h
+++ b/src/fe-common/core/formats.h
@@ -86,9 +86,10 @@ char *format_get_text_theme_charargs(THEME_REC *theme, const char *module,
TEXT_DEST_REC *dest, int formatnum,
char **args);
-/* add `linestart' to start of each line in `text'. `text' may contain
+/* add `linestart' to start/end of each line in `text'. `text' may contain
multiple lines separated with \n. */
char *format_add_linestart(const char *text, const char *linestart);
+char *format_add_lineend(const char *text, const char *linestart);
/* return the "-!- " text at the start of the line */
char *format_get_level_tag(THEME_REC *theme, TEXT_DEST_REC *dest);
diff --git a/src/fe-common/core/keyboard.c b/src/fe-common/core/keyboard.c
index ac682001..e622f973 100644
--- a/src/fe-common/core/keyboard.c
+++ b/src/fe-common/core/keyboard.c
@@ -683,7 +683,7 @@ static void cmd_bind(const char *data)
command_id = strchr(settings_get_str("cmdchars"), *id) != NULL;
if (command_id) {
/* using shortcut to command id */
- keydata = g_strconcat(id, " ", keydata, NULL);
+ keydata = g_strconcat(id+1, " ", keydata, NULL);
id = "command";
}
diff --git a/src/fe-common/core/printtext.c b/src/fe-common/core/printtext.c
index 2f6c19ea..36984219 100644
--- a/src/fe-common/core/printtext.c
+++ b/src/fe-common/core/printtext.c
@@ -158,13 +158,16 @@ void printformat_module_gui(const char *module, int formatnum, ...)
static void print_line(TEXT_DEST_REC *dest, const char *text)
{
+ THEME_REC *theme;
char *str, *tmp, *stripped;
g_return_if_fail(dest != NULL);
g_return_if_fail(text != NULL);
- tmp = format_get_level_tag(window_get_theme(dest->window), dest);
- str = format_add_linestart(text, tmp);
+ theme = window_get_theme(dest->window);
+ tmp = format_get_level_tag(theme, dest);
+ str = !theme->info_eol ? format_add_linestart(text, tmp) :
+ format_add_lineend(text, tmp);
g_free_not_null(tmp);
/* send both the formatted + stripped (for logging etc.) */
@@ -408,6 +411,7 @@ static void msg_beep_check(TEXT_DEST_REC *dest)
static void sig_print_text(TEXT_DEST_REC *dest, const char *text)
{
+ THEME_REC *theme;
char *str, *tmp;
g_return_if_fail(dest != NULL);
@@ -421,9 +425,11 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text)
/* add timestamp/server tag here - if it's done in print_line()
it would be written to log files too */
- tmp = format_get_line_start(window_get_theme(dest->window),
- dest, time(NULL));
- str = format_add_linestart(text, tmp);
+ theme = window_get_theme(dest->window);
+ tmp = format_get_line_start(theme, dest, time(NULL));
+ str = !theme->info_eol ? format_add_linestart(text, tmp) :
+ format_add_lineend(text, tmp);
+
g_free_not_null(tmp);
format_send_to_gui(dest, str);
diff --git a/src/fe-common/core/themes.c b/src/fe-common/core/themes.c
index a004dd56..ec4a994a 100644
--- a/src/fe-common/core/themes.c
+++ b/src/fe-common/core/themes.c
@@ -844,6 +844,8 @@ static int theme_read(THEME_REC *theme, const char *path, const char *data)
theme->default_color =
config_get_int(config, NULL, "default_color", -1);
+ theme->info_eol = config_get_bool(config, NULL, "info_eol", FALSE);
+
/* FIXME: remove after 0.7.99 */
if (theme->default_color == 0 &&
config_get_int(config, NULL, "default_real_color", -1) != -1)
diff --git a/src/fe-common/core/themes.h b/src/fe-common/core/themes.h
index 59d2810a..3ef7cb92 100644
--- a/src/fe-common/core/themes.h
+++ b/src/fe-common/core/themes.h
@@ -18,6 +18,9 @@ typedef struct {
int default_color; /* default color to use with text with default
background. default is -1 which means the
default color set by terminal */
+ unsigned int info_eol:1; /* show the timestamp/servertag at the
+ end of the line, not at beginning */
+
GHashTable *modules;
int replace_keys[256]; /* index to replace_values for each char */