[gnome-builder/wip/gtk4-port] libide/code: always add \n when trailing-newline is set
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] libide/code: always add \n when trailing-newline is set
- Date: Wed, 6 Apr 2022 22:14:31 +0000 (UTC)
commit deb0f749f4ae46b3c17a84acf46c43c139eeb7b9
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 c8fd91ff2..4505f24e6 100644
--- a/src/libide/code/ide-buffer.c
+++ b/src/libide/code/ide-buffer.c
@@ -2739,8 +2739,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]