[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/Plaintext.pm (ensure_end_of_
From: |
Gavin D. Smith |
Subject: |
branch master updated: * tp/Texinfo/Convert/Plaintext.pm (ensure_end_of_line): Adjust implementation slightly so not to take a newline off before putting one back on. No functional changes intended. |
Date: |
Wed, 03 Jan 2024 07:19:40 -0500 |
This is an automated email from the git hooks/post-receive script.
gavin pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new a38bc14650 * tp/Texinfo/Convert/Plaintext.pm (ensure_end_of_line):
Adjust implementation slightly so not to take a newline off before putting one
back on. No functional changes intended.
a38bc14650 is described below
commit a38bc14650f4a68777145eb26df2d87a51203256
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Wed Jan 3 12:17:33 2024 +0000
* tp/Texinfo/Convert/Plaintext.pm (ensure_end_of_line):
Adjust implementation slightly so not to take a newline off
before putting one back on. No functional changes intended.
---
ChangeLog | 6 ++++++
tp/Texinfo/Convert/Plaintext.pm | 13 +++++--------
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 17e5078ecb..5b0d5d5386 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-01-03 Gavin Smith <gavinsmith0123@gmail.com>
+
+ * tp/Texinfo/Convert/Plaintext.pm (ensure_end_of_line):
+ Adjust implementation slightly so not to take a newline off
+ before putting one back on. No functional changes intended.
+
2023-12-31 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/HTML.pm (_convert_tab_command): reorder code.
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index c2568269d9..6d80a0c259 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -1627,15 +1627,12 @@ sub ensure_end_of_line($$)
{
my ($self, $text) = @_;
- my $chomped = chomp ($text);
- if ($chomped) {
- $self->{'count_context'}->[-1]->{'bytes'} -= count_bytes($self, $chomped);
- $self->{'count_context'}->[-1]->{'lines'} -= 1;
+ if (substr($text, -1) ne "\n") {
+ $text .= "\n";
+ add_text_to_count($self, "\n");
+ _add_lines_count($self, 1);
+ $self->{'text_element_context'}->[-1]->{'counter'} = 0;
}
- $text .= "\n";
- $self->{'text_element_context'}->[-1]->{'counter'} = 0;
- add_text_to_count($self, "\n");
- _add_lines_count($self, 1);
return $text;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/Plaintext.pm (ensure_end_of_line): Adjust implementation slightly so not to take a newline off before putting one back on. No functional changes intended.,
Gavin D. Smith <=