about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command/cmd_ac.c6
-rw-r--r--src/command/cmd_funcs.c11
-rw-r--r--src/config/preferences.c3
-rw-r--r--src/config/preferences.h1
-rw-r--r--src/config/theme.c1
-rw-r--r--src/ui/console.c5
-rw-r--r--src/ui/occupantswin.c8
7 files changed, 33 insertions, 2 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index 9356d8e8..306f789e 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -687,6 +687,7 @@ cmd_ac_init(void)
     autocomplete_add(occupants_ac, "size");
     autocomplete_add(occupants_ac, "indent");
     autocomplete_add(occupants_ac, "header");
+    autocomplete_add(occupants_ac, "wrap");
 
     occupants_default_ac = autocomplete_new();
     autocomplete_add(occupants_default_ac, "show");
@@ -2592,6 +2593,11 @@ _occupants_autocomplete(ProfWin *window, const char *const input, gboolean previ
         return found;
     }
 
+    found = autocomplete_param_with_func(input, "/occupants wrap", prefs_autocomplete_boolean_choice, previous);
+    if (found) {
+        return found;
+    }
+
     found = autocomplete_param_with_ac(input, "/occupants", occupants_ac, TRUE, previous);
     if (found) {
         return found;
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index aa31c3af..e87f5bb5 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -4391,6 +4391,17 @@ cmd_occupants(ProfWin *window, const char *const command, gchar **args)
         }
     }
 
+    if (g_strcmp0(args[0], "wrap") == 0) {
+        if (!args[1]) {
+            cons_bad_cmd_usage(command);
+            return TRUE;
+        } else {
+            _cmd_set_boolean_preference(args[1], command, "Occupants panel line wrap", PREF_OCCUPANTS_WRAP);
+             occupantswin_occupants_all();
+            return TRUE;
+        }
+    }
+
     if (g_strcmp0(args[0], "default") == 0) {
         if (g_strcmp0(args[1], "show") == 0) {
             if (g_strcmp0(args[2], "jid") == 0) {
diff --git a/src/config/preferences.c b/src/config/preferences.c
index adc15dda..4fd96381 100644
--- a/src/config/preferences.c
+++ b/src/config/preferences.c
@@ -1641,6 +1641,7 @@ _get_group(preference_t pref)
         case PREF_HISTORY:
         case PREF_OCCUPANTS:
         case PREF_OCCUPANTS_JID:
+        case PREF_OCCUPANTS_WRAP:
         case PREF_STATUSES:
         case PREF_STATUSES_CONSOLE:
         case PREF_STATUSES_CHAT:
@@ -1788,6 +1789,8 @@ _get_key(preference_t pref)
             return "occupants";
         case PREF_OCCUPANTS_JID:
             return "occupants.jid";
+        case PREF_OCCUPANTS_WRAP:
+            return "occupants.wrap";
         case PREF_MUC_PRIVILEGES:
             return "privileges";
         case PREF_STATUSES:
diff --git a/src/config/preferences.h b/src/config/preferences.h
index 6e6cfeb3..5bc82dc9 100644
--- a/src/config/preferences.h
+++ b/src/config/preferences.h
@@ -150,6 +150,7 @@ typedef enum {
     PREF_STATUSBAR_ROOM,
     PREF_OMEMO_LOG,
     PREF_OMEMO_POLICY,
+    PREF_OCCUPANTS_WRAP,
 } preference_t;
 
 typedef struct prof_alias_t {
diff --git a/src/config/theme.c b/src/config/theme.c
index f92ab241..ddb4252f 100644
--- a/src/config/theme.c
+++ b/src/config/theme.c
@@ -388,6 +388,7 @@ _load_preferences(void)
     _set_boolean_preference("resource.message", PREF_RESOURCE_MESSAGE);
     _set_boolean_preference("occupants", PREF_OCCUPANTS);
     _set_boolean_preference("occupants.jid", PREF_OCCUPANTS_JID);
+    _set_boolean_preference("occupants.wrap", PREF_OCCUPANTS_WRAP);
     _set_boolean_preference("roster", PREF_ROSTER);
     _set_boolean_preference("roster.offline", PREF_ROSTER_OFFLINE);
     _set_boolean_preference("roster.resource", PREF_ROSTER_RESOURCE);
diff --git a/src/ui/console.c b/src/ui/console.c
index cdf602b2..f1fa3231 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -1232,6 +1232,11 @@ cons_occupants_setting(void)
     else
         cons_show("Occupant jids (/occupants)          : hide");
 
+    if (prefs_get_boolean(PREF_OCCUPANTS_WRAP))
+        cons_show("Occupants wrap (/occupants)         : ON");
+    else
+        cons_show("Occupants wrap (/occupants)         : OFF");
+
     gint occupant_indent = prefs_get_occupants_indent();
     cons_show("Occupant indent (/occupants)        : %d", occupant_indent);
 
diff --git a/src/ui/occupantswin.c b/src/ui/occupantswin.c
index 2566f57f..e05a26ce 100644
--- a/src/ui/occupantswin.c
+++ b/src/ui/occupantswin.c
@@ -49,7 +49,9 @@ _occuptantswin_occupant(ProfLayoutSplit *layout, Occupant *occupant, gboolean sh
     GString *spaces = g_string_new(" ");
 
     int indent = prefs_get_occupants_indent();
+    int current_indent = 0;
     if (indent > 0) {
+        current_indent += indent;
         while (indent > 0) {
             g_string_append(spaces, " ");
             indent--;
@@ -59,8 +61,10 @@ _occuptantswin_occupant(ProfLayoutSplit *layout, Occupant *occupant, gboolean sh
     GString *msg = g_string_new("");
     g_string_append(msg, spaces->str);
 
+    gboolean wrap = prefs_get_boolean(PREF_OCCUPANTS_WRAP);
+
     g_string_append(msg, occupant->nick);
-    win_sub_print(layout->subwin, msg->str, TRUE, FALSE, 0);
+    win_sub_print(layout->subwin, msg->str, TRUE, wrap, current_indent);
     g_string_free(msg, TRUE);
 
     if (showjid && occupant->jid) {
@@ -69,7 +73,7 @@ _occuptantswin_occupant(ProfLayoutSplit *layout, Occupant *occupant, gboolean sh
         g_string_append(msg, " ");
 
         g_string_append(msg, occupant->jid);
-        win_sub_print(layout->subwin, msg->str, TRUE, FALSE, 0);
+        win_sub_print(layout->subwin, msg->str, TRUE, wrap, current_indent);
         g_string_free(msg, TRUE);
     }
 
24'>424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472