about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-11-09 23:29:25 +0000
committerJames Booth <boothj5@gmail.com>2014-11-09 23:29:25 +0000
commit46583839df397ce9634d147a28e79134b7045ea9 (patch)
treed3f699fe3c29d7b5a46990cfae261fef1599d40e /src/command
parent70501f5dbf1b8d80b80c7b24e0e6ab46921ba7dd (diff)
downloadprofani-tty-46583839df397ce9634d147a28e79134b7045ea9.tar.gz
Added /wrap user preference for enabling/disabling word wrapping
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c10
-rw-r--r--src/command/commands.c12
-rw-r--r--src/command/commands.h1
3 files changed, 21 insertions, 2 deletions
diff --git a/src/command/command.c b/src/command/command.c
index c898f4b7..3300097f 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -578,6 +578,14 @@ static struct cmd_t command_defs[] =
           "Switch display of the contacts presence on or off.",
           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",
         cmd_notify, parse_args, 2, 3, &cons_notify_setting,
         { "/notify [type value]|[type setting value]", "Control various desktop noficiations.",
@@ -1773,7 +1781,7 @@ _cmd_complete_parameters(char *input, int *size)
     // autocomplete boolean settings
     gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype",
         "/flash", "/splash", "/chlog", "/grlog", "/mouse", "/history", "/titlebar",
-        "/vercheck", "/privileges", "/presence" };
+        "/vercheck", "/privileges", "/presence", "/wrap" };
 
     for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
         result = autocomplete_param_with_func(input, size, boolean_choices[i],
diff --git a/src/command/commands.c b/src/command/commands.c
index 45421829..98ebe90c 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -620,7 +620,7 @@ cmd_help(gchar **args, struct cmd_help_t help)
             "/chlog", "/flash", "/gone", "/grlog", "/history", "/intype",
             "/log", "/mouse", "/notify", "/outtype", "/prefs", "/priority",
             "/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));
 
     } else if (strcmp(args[0], "navigation") == 0) {
@@ -2929,6 +2929,16 @@ cmd_presence(gchar **args, struct cmd_help_t help)
 }
 
 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
 cmd_states(gchar **args, struct cmd_help_t help)
 {
     gboolean result = _cmd_set_boolean_preference(args[0], help, "Sending chat states",
diff --git a/src/command/commands.h b/src/command/commands.h
index 245a2944..87c05453 100644
--- a/src/command/commands.h
+++ b/src/command/commands.h
@@ -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_privileges(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);