[gnome-builder/wip/gtk4-port: 440/736] libide/code: always add \n when trailing-newline is set




commit 38e2ade5d0e8c8b44ed66240f9aaf22179f8f456
Author: Christian Hergert <chergert redhat com>
Date:   Wed Apr 6 15:14:08 2022 -0700

    libide/code: always add \n when trailing-newline is set
    
    This shouldn't be checking to see if we have a newline, but instead always
    add the trailing newline.

 src/libide/code/ide-buffer.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
---
diff --git a/src/libide/code/ide-buffer.c b/src/libide/code/ide-buffer.c
index c900c4c4d..efceb67a7 100644
--- a/src/libide/code/ide-buffer.c
+++ b/src/libide/code/ide-buffer.c
@@ -2820,8 +2820,7 @@ ide_buffer_dup_content (IdeBuffer *self)
        * files will restore to a buffer, for which \n is acceptable.
        */
       len = strlen (text);
-      if (gtk_source_buffer_get_implicit_trailing_newline (GTK_SOURCE_BUFFER (self)) &&
-          (len == 0 || text[len - 1] != '\n'))
+      if (gtk_source_buffer_get_implicit_trailing_newline (GTK_SOURCE_BUFFER (self)))
         {
           if (!ide_buffer_can_do_newline_hack (self, len))
             {


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