FS#13920 text_editor.c plugin do not terminate last line with \n

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]> Fri, 5 Jun 2026 09:34:39 -0400
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 7517674513eb69cfacdbf93fe3c72b30f658d005
Author: William Wilgus <[email protected]>
Date:   Fri Jun 5 02:17:38 2026 -0400

    FS#13920 text_editor.c plugin  do not terminate last line with \n
    
    you can still add a \n by inserting a blank line
    
    Change-Id: Ic3e69fce83ccc9c050857a03877545a7452ce8a2

diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c
index 677b5afd56..2fcdb90b9a 100644
--- a/apps/plugins/text_editor.c
+++ b/apps/plugins/text_editor.c
@@ -203,14 +203,16 @@ static bool save_changes(int overwrite)
     }
 
     rb->lcd_clear_display();
-    cpuboost(1);
 
-    for (i=0;i<line_count;i++)
+    cpuboost(1);
+    for (i=0;i<line_count - 1;i++)
     {
         rb->fdprintf(fd,"%s%s", do_action(ACTION_GET, 0, i), eol);
     }
-
+    if (line_count > 0)  /* No EOL for last item */
+        rb->fdprintf(fd,"%s", do_action(ACTION_GET, 0, line_count - 1));
     cpuboost(0);
+
     rb->close(fd);
 
     if (newfile || !overwrite)
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs