Merge pull request #697 from ailin-nemui/rsplit

sideways split support for Irssi
This commit is contained in:
ailin-nemui 2018-01-08 12:20:20 +01:00 committed by GitHub
commit a6663c58d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 1396 additions and 357 deletions

View file

@ -11,6 +11,14 @@ enum {
DATA_LEVEL_HILIGHT
};
enum {
MAIN_WINDOW_TYPE_NONE = -1,
MAIN_WINDOW_TYPE_DEFAULT = 0,
MAIN_WINDOW_TYPE_HIDDEN = 1,
MAIN_WINDOW_TYPE_SPLIT = 2,
MAIN_WINDOW_TYPE_RSPLIT = 3
};
typedef struct {
char *servertag;
char *name;

View file

@ -480,27 +480,30 @@ int format_real_length(const char *str, int len)
start = str;
tmp = g_string_new(NULL);
while (*str != '\0' && len > 0) {
while (*str != '\0') {
oldstr = str;
if (*str == '%' && str[1] != '\0') {
str++;
if (*str != '%') {
adv = format_expand_styles(tmp, &str, NULL);
str += adv;
if (adv)
continue;
}
/* %% or unknown %code, written as-is */
if (*str != '%') {
if (--len == 0)
break;
if (adv) {
str += adv;
continue;
}
/* discount for unknown % */
if (--len < 0) {
str = oldstr;
break;
}
oldstr = str;
}
}
oldstr = str;
len -= string_advance(&str, utf8);
if (len < 0)
if (len < 0) {
str = oldstr;
break;
}
}
g_string_free(tmp, TRUE);

View file

@ -169,7 +169,7 @@ static void cmd_window(const char *data, void *server, WI_ITEM_REC *item)
command_runsub("window", data, server, item);
}
/* SYNTAX: WINDOW NEW [HIDDEN|SPLIT] */
/* SYNTAX: WINDOW NEW [HIDDEN|SPLIT|RSPLIT] */
static void cmd_window_new(const char *data, void *server, WI_ITEM_REC *item)
{
WINDOW_REC *window;
@ -177,8 +177,9 @@ static void cmd_window_new(const char *data, void *server, WI_ITEM_REC *item)
g_return_if_fail(data != NULL);
type = (g_ascii_strncasecmp(data, "hid", 3) == 0 || g_ascii_strcasecmp(data, "tab") == 0) ? 1 :
(g_ascii_strcasecmp(data, "split") == 0 ? 2 : 0);
type = (g_ascii_strncasecmp(data, "hid", 3) == 0 || g_ascii_strcasecmp(data, "tab") == 0) ? MAIN_WINDOW_TYPE_HIDDEN :
g_ascii_strcasecmp(data, "split") == 0 ? MAIN_WINDOW_TYPE_SPLIT :
g_ascii_strncasecmp(data, "rs", 2) == 0 ? MAIN_WINDOW_TYPE_RSPLIT : MAIN_WINDOW_TYPE_DEFAULT;
signal_emit("gui window create override", 1, GINT_TO_POINTER(type));
window = window_create(NULL, FALSE);

View file

@ -314,7 +314,7 @@ void window_item_create(WI_ITEM_REC *item, int automatic)
/* create new window to use */
if (settings_get_bool("autocreate_split_windows")) {
signal_emit("gui window create override", 1,
GINT_TO_POINTER(0));
GINT_TO_POINTER(MAIN_WINDOW_TYPE_SPLIT));
}
window = window_create(item, automatic);
} else {