Standardise line wrap width in config.inc.php, notify post of width.

This commit is contained in:
Retro_Guy 2024-09-19 05:19:26 -07:00
parent 43a61d7acd
commit c2659424c8
4 changed files with 12 additions and 9 deletions

View File

@ -310,8 +310,8 @@ textarea.postbody {
background-color: var(--color-medium);
border: none;
color: var(--color-text);
height: calc(1em * 1.5 * 20);
width: calc(1em * 1.5 * 40);
height: calc(1em * 40);
width: auto;
}
textarea.configuration {

View File

@ -216,6 +216,7 @@ if (isset($_SERVER["HTTP_HOST"])) {
}
$post_autoquote = false;
$post_captcha = false;
$wrap_width = 72;
/*
* Attachments

View File

@ -3009,7 +3009,7 @@ function check_article_integrity($rawmessage)
function wrap_post($body)
{
$line_length = 72;
global $wrap_width;
$lines = preg_split("/\n/", $body);
$wrapped = '';
foreach ($lines as $line) {
@ -3026,11 +3026,11 @@ function wrap_post($body)
break;
}
}
if (strlen($line) > $line_length) {
if (strlen($line) > $wrap_width) {
// HERE is where we wrap quoted lines (not so easy)
$start = substr($line, 0, $depth + 1);
$end = substr($line, $depth + 1);
$line_wrapped = $start . mb_wordwrap($end, $line_length);
$line_wrapped = $start . mb_wordwrap($end, $wrap_width);
$line_wrapped = preg_split("/\n/", $line_wrapped);
foreach ($line_wrapped as $lw) {
if ($lw[0] != '>') {
@ -3047,9 +3047,9 @@ function wrap_post($body)
$wrapped .= $line . "\n";
}
} else {
if (strlen($line) > $line_length) {
if (strlen($line) > $wrap_width) {
// HERE is where we wrap NON quoted lines (easy)
$wrapped .= mb_wordwrap($line, $line_length) . "\n";
$wrapped .= mb_wordwrap($line, $wrap_width) . "\n";
} else {
$wrapped .= $line . "\n";
}

View File

@ -590,8 +590,10 @@ if ($show == 1) {
echo '<div class="np_post_body">';
echo '<table><tr>';
echo '<td><b>' . $text_post["message"] . '</b><br> <textarea ';
echo 'class="postbody" id="postbody" ';
echo '<td><b>' . $text_post["message"] . '</b>';
echo '&nbsp;&nbsp;<font size="2em">(Lines will wrap at ' . $wrap_width . ' characters after posting)</font>';
echo '<br> <textarea cols="' . $wrap_width . '"';
echo 'class="postbody" id="postbody" cols="72"';
echo 'name="' . md5($fieldencrypt . "body") . '" wrap="soft">';
$bodyzeile = wrap_post($bodyzeile);