mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added /wrap user preference for enabling/disabling word wrapping
This commit is contained in:
parent
70501f5dbf
commit
46583839df
@ -578,6 +578,14 @@ static struct cmd_t command_defs[] =
|
|||||||
"Switch display of the contacts presence on or off.",
|
"Switch display of the contacts presence on or off.",
|
||||||
NULL } } },
|
NULL } } },
|
||||||
|
|
||||||
|
{ "/wrap",
|
||||||
|
cmd_wrap, parse_args, 1, 1, &cons_wrap_setting,
|
||||||
|
{ "/wrap on|off", "Word wrapping.",
|
||||||
|
{ "/wrap on|off",
|
||||||
|
"------------",
|
||||||
|
"Enable or disable word wrapping.",
|
||||||
|
NULL } } },
|
||||||
|
|
||||||
{ "/notify",
|
{ "/notify",
|
||||||
cmd_notify, parse_args, 2, 3, &cons_notify_setting,
|
cmd_notify, parse_args, 2, 3, &cons_notify_setting,
|
||||||
{ "/notify [type value]|[type setting value]", "Control various desktop noficiations.",
|
{ "/notify [type value]|[type setting value]", "Control various desktop noficiations.",
|
||||||
@ -1773,7 +1781,7 @@ _cmd_complete_parameters(char *input, int *size)
|
|||||||
// autocomplete boolean settings
|
// autocomplete boolean settings
|
||||||
gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype",
|
gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype",
|
||||||
"/flash", "/splash", "/chlog", "/grlog", "/mouse", "/history", "/titlebar",
|
"/flash", "/splash", "/chlog", "/grlog", "/mouse", "/history", "/titlebar",
|
||||||
"/vercheck", "/privileges", "/presence" };
|
"/vercheck", "/privileges", "/presence", "/wrap" };
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
|
for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
|
||||||
result = autocomplete_param_with_func(input, size, boolean_choices[i],
|
result = autocomplete_param_with_func(input, size, boolean_choices[i],
|
||||||
|
@ -620,7 +620,7 @@ cmd_help(gchar **args, struct cmd_help_t help)
|
|||||||
"/chlog", "/flash", "/gone", "/grlog", "/history", "/intype",
|
"/chlog", "/flash", "/gone", "/grlog", "/history", "/intype",
|
||||||
"/log", "/mouse", "/notify", "/outtype", "/prefs", "/priority",
|
"/log", "/mouse", "/notify", "/outtype", "/prefs", "/priority",
|
||||||
"/reconnect", "/roster", "/splash", "/states", "/statuses", "/theme",
|
"/reconnect", "/roster", "/splash", "/states", "/statuses", "/theme",
|
||||||
"/titlebar", "/vercheck", "/privileges", "/occupants", "/presence" };
|
"/titlebar", "/vercheck", "/privileges", "/occupants", "/presence", "/wrap" };
|
||||||
_cmd_show_filtered_help("Settings commands", filter, ARRAY_SIZE(filter));
|
_cmd_show_filtered_help("Settings commands", filter, ARRAY_SIZE(filter));
|
||||||
|
|
||||||
} else if (strcmp(args[0], "navigation") == 0) {
|
} else if (strcmp(args[0], "navigation") == 0) {
|
||||||
@ -2928,6 +2928,16 @@ cmd_presence(gchar **args, struct cmd_help_t help)
|
|||||||
return _cmd_set_boolean_preference(args[0], help, "Contact presence", PREF_PRESENCE);
|
return _cmd_set_boolean_preference(args[0], help, "Contact presence", PREF_PRESENCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
cmd_wrap(gchar **args, struct cmd_help_t help)
|
||||||
|
{
|
||||||
|
gboolean result = _cmd_set_boolean_preference(args[0], help, "Word wrap", PREF_WRAP);
|
||||||
|
|
||||||
|
wins_resize_all();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
cmd_states(gchar **args, struct cmd_help_t help)
|
cmd_states(gchar **args, struct cmd_help_t help)
|
||||||
{
|
{
|
||||||
|
@ -133,6 +133,7 @@ gboolean cmd_affiliation(gchar **args, struct cmd_help_t help);
|
|||||||
gboolean cmd_role(gchar **args, struct cmd_help_t help);
|
gboolean cmd_role(gchar **args, struct cmd_help_t help);
|
||||||
gboolean cmd_privileges(gchar **args, struct cmd_help_t help);
|
gboolean cmd_privileges(gchar **args, struct cmd_help_t help);
|
||||||
gboolean cmd_presence(gchar **args, struct cmd_help_t help);
|
gboolean cmd_presence(gchar **args, struct cmd_help_t help);
|
||||||
|
gboolean cmd_wrap(gchar **args, struct cmd_help_t help);
|
||||||
|
|
||||||
gboolean cmd_form_field(char *tag, gchar **args);
|
gboolean cmd_form_field(char *tag, gchar **args);
|
||||||
|
|
||||||
|
@ -452,6 +452,7 @@ _get_group(preference_t pref)
|
|||||||
case PREF_STATUSES_MUC:
|
case PREF_STATUSES_MUC:
|
||||||
case PREF_MUC_PRIVILEGES:
|
case PREF_MUC_PRIVILEGES:
|
||||||
case PREF_PRESENCE:
|
case PREF_PRESENCE:
|
||||||
|
case PREF_WRAP:
|
||||||
return PREF_GROUP_UI;
|
return PREF_GROUP_UI;
|
||||||
case PREF_STATES:
|
case PREF_STATES:
|
||||||
case PREF_OUTTYPE:
|
case PREF_OUTTYPE:
|
||||||
@ -570,6 +571,8 @@ _get_key(preference_t pref)
|
|||||||
return "shared";
|
return "shared";
|
||||||
case PREF_PRESENCE:
|
case PREF_PRESENCE:
|
||||||
return "presence";
|
return "presence";
|
||||||
|
case PREF_WRAP:
|
||||||
|
return "wrap";
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -592,6 +595,7 @@ _get_default_boolean(preference_t pref)
|
|||||||
case PREF_OCCUPANTS:
|
case PREF_OCCUPANTS:
|
||||||
case PREF_MUC_PRIVILEGES:
|
case PREF_MUC_PRIVILEGES:
|
||||||
case PREF_PRESENCE:
|
case PREF_PRESENCE:
|
||||||
|
case PREF_WRAP:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -60,6 +60,7 @@ typedef enum {
|
|||||||
PREF_OCCUPANTS,
|
PREF_OCCUPANTS,
|
||||||
PREF_MUC_PRIVILEGES,
|
PREF_MUC_PRIVILEGES,
|
||||||
PREF_PRESENCE,
|
PREF_PRESENCE,
|
||||||
|
PREF_WRAP,
|
||||||
PREF_STATUSES,
|
PREF_STATUSES,
|
||||||
PREF_STATUSES_CONSOLE,
|
PREF_STATUSES_CONSOLE,
|
||||||
PREF_STATUSES_CHAT,
|
PREF_STATUSES_CHAT,
|
||||||
|
@ -840,6 +840,15 @@ _cons_beep_setting(void)
|
|||||||
cons_show("Terminal beep (/beep) : OFF");
|
cons_show("Terminal beep (/beep) : OFF");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cons_wrap_setting(void)
|
||||||
|
{
|
||||||
|
if (prefs_get_boolean(PREF_WRAP))
|
||||||
|
cons_show("Word wrap (/wrap) : ON");
|
||||||
|
else
|
||||||
|
cons_show("Word wrap (/wrap) : OFF");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cons_presence_setting(void)
|
_cons_presence_setting(void)
|
||||||
{
|
{
|
||||||
@ -941,6 +950,7 @@ _cons_show_ui_prefs(void)
|
|||||||
cons_beep_setting();
|
cons_beep_setting();
|
||||||
cons_flash_setting();
|
cons_flash_setting();
|
||||||
cons_splash_setting();
|
cons_splash_setting();
|
||||||
|
cons_wrap_setting();
|
||||||
cons_vercheck_setting();
|
cons_vercheck_setting();
|
||||||
cons_mouse_setting();
|
cons_mouse_setting();
|
||||||
cons_statuses_setting();
|
cons_statuses_setting();
|
||||||
@ -1557,6 +1567,7 @@ console_init_module(void)
|
|||||||
cons_theme_setting = _cons_theme_setting;
|
cons_theme_setting = _cons_theme_setting;
|
||||||
cons_privileges_setting = _cons_privileges_setting;
|
cons_privileges_setting = _cons_privileges_setting;
|
||||||
cons_beep_setting = _cons_beep_setting;
|
cons_beep_setting = _cons_beep_setting;
|
||||||
|
cons_wrap_setting = _cons_wrap_setting;
|
||||||
cons_presence_setting = _cons_presence_setting;
|
cons_presence_setting = _cons_presence_setting;
|
||||||
cons_flash_setting = _cons_flash_setting;
|
cons_flash_setting = _cons_flash_setting;
|
||||||
cons_splash_setting = _cons_splash_setting;
|
cons_splash_setting = _cons_splash_setting;
|
||||||
|
@ -300,6 +300,7 @@ void (*cons_splash_setting)(void);
|
|||||||
void (*cons_vercheck_setting)(void);
|
void (*cons_vercheck_setting)(void);
|
||||||
void (*cons_occupants_setting)(void);
|
void (*cons_occupants_setting)(void);
|
||||||
void (*cons_presence_setting)(void);
|
void (*cons_presence_setting)(void);
|
||||||
|
void (*cons_wrap_setting)(void);
|
||||||
void (*cons_mouse_setting)(void);
|
void (*cons_mouse_setting)(void);
|
||||||
void (*cons_statuses_setting)(void);
|
void (*cons_statuses_setting)(void);
|
||||||
void (*cons_titlebar_setting)(void);
|
void (*cons_titlebar_setting)(void);
|
||||||
|
@ -583,10 +583,13 @@ _win_print(ProfWin *window, const char show_char, const char * const date_fmt,
|
|||||||
|
|
||||||
wattron(window->win, attrs);
|
wattron(window->win, attrs);
|
||||||
|
|
||||||
if (flags & NO_EOL) {
|
if (prefs_get_boolean(PREF_WRAP)) {
|
||||||
_win_print_wrapped(window->win, message+offset);
|
_win_print_wrapped(window->win, message+offset);
|
||||||
} else {
|
} else {
|
||||||
_win_print_wrapped(window->win, message+offset);
|
wprintw(window->win, "%s", message+offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((flags & NO_EOL) == 0) {
|
||||||
wprintw(window->win, "\n");
|
wprintw(window->win, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user