poe

Уређивач .po фајлова
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување 72644534c2586ead6bc4984e73e620134f944bd1
родитељ 4559228735240d35f1c29e9a467e1d2ba52c3cb1
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Tue,  8 Feb 2022 19:45:32 +0100

util.c(u32_lines_in_string): Fix case when newline at end of string

Signed-off-by: Страхиња Радић <contact@strahinja.org>

Diffstat:
Mutil.c | 7+++++--
измењених датотека: 1, додавања: 5(+), брисања: 2(-)

diff --git a/util.c b/util.c @@ -225,6 +225,7 @@ u32_lines_in_string(const uint32_t* s, const int include_eol, const size_t wrap) { size_t result = 1; const uint32_t* ps = NULL; + int last_empty = 0; if (!s) return result; @@ -236,7 +237,9 @@ u32_lines_in_string(const uint32_t* s, const int include_eol, const size_t wrap) if (*ps) result++; } - return result; + if (ps > s + 1 && *(ps-2) == '\\' && *(ps-1) == 'n') + last_empty = 1; + return result + last_empty; } /* @@ -297,7 +300,7 @@ u32_next_line(const uint32_t* s, const uint32_t** next_line, if (next_line) *next_line = ps; - return result + 1; + return result; } int