[vte] ring: Tiny code cleanup: maintain GString integrity



commit 7f6e48ce00eb0fd6992966a66df6464e85cfda84
Author: Egmont Koblinger <egmont gmail com>
Date:   Fri Oct 11 13:04:41 2019 +0200

    ring: Tiny code cleanup: maintain GString integrity

 src/ring.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/ring.cc b/src/ring.cc
index 9981901b..2d76d136 100644
--- a/src/ring.cc
+++ b/src/ring.cc
@@ -1026,7 +1026,7 @@ Ring::frozen_row_column_to_text_offset(row_t position,
                return false;
 
        if (G_LIKELY (buffer->len && buffer->str[buffer->len - 1] == '\n'))
-               buffer->len--;
+                g_string_truncate (buffer, buffer->len - 1);
 
        row = index(position);
 
@@ -1101,7 +1101,7 @@ Ring::frozen_row_text_offset_to_column(row_t position,
                return false;
 
        if (G_LIKELY (buffer->len && buffer->str[buffer->len - 1] == '\n'))
-               buffer->len--;
+                g_string_truncate (buffer, buffer->len - 1);
 
         /* Now that we've chopped off the likely trailing newline (which is only rarely missing,
          * if the ring ends in a soft wrapped line; see bug 181), the position we're about to


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]