mirror of
https://github.com/anope/anope.git
synced 2026-06-12 19:14:47 +02:00
Allow customising the length at which lines are wrapped after.
Closes #485.
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
+3
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user