diff options
author | Sadie Powell <sadie@witchery.services> | 2025-03-21 19:16:48 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2025-03-22 07:33:02 +0000 |
commit | ecbf53ba6c8d95b9da138307ee772adb87ec4f1d (patch) | |
tree | aada9fa659f929752d60f4665177d90fb963b376 | |
parent | 6d72fd67d8bc33a1aaf6e14c74374bc04e0abe7e (diff) |
Allow customising the length at which lines are wrapped after.
Closes #485.
-rw-r--r-- | data/anope.example.conf | 12 | ||||
-rw-r--r-- | src/misc.cpp | 5 |
2 files changed, 15 insertions, 2 deletions
diff --git a/data/anope.example.conf b/data/anope.example.conf index 653de1b61..62f13b6a4 100644 --- a/data/anope.example.conf +++ b/data/anope.example.conf @@ -479,6 +479,18 @@ options */ didyoumeandifference = 4 + /* + * If set, the maximum number of bytes after which to wrap services messages. This + * can be set a bit higher than the default but should be well under the maximum + * message length imposed by your IRC server or messages will end up truncated. + * + * NOTE: this currently only applies to tables but will be expanded to all messages + * in a later release. + * + * Defaults to 120 if not set. + */ + linelength = 120 + /* The regex engine to use, as provided by the regex modules. * Leave commented to disable regex matching. * diff --git a/src/misc.cpp b/src/misc.cpp index 4832fabcb..a472f5b15 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -159,11 +159,12 @@ void ListFormatter::Process(std::vector<Anope::string> &buffer) lengths[column] = entry[column].length(); } } + const auto max_length = Config->GetBlock("options").Get<size_t>("linelength", "120"); unsigned total_length = 0; for (const auto &[column, length] : lengths) { - /* Break lines at 80 chars */ - if (total_length > 80) + // Break lines that are getting too long. + if (total_length > max_length) { breaks.insert(column); total_length = 0; |