[lua][BUGFIX] splash_scroller FS#13753, 13754 unicode + default font/fg/bg

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 6035b1fc1b4279e5dd40c58a89f1c7b14661ea9c
Author: William Wilgus <[email protected]>
Date:   Sat Jan 24 09:13:24 2026 -0500

    [lua][BUGFIX] splash_scroller FS#13753, 13754 unicode + default font/fg/bg
    
    FS#13753 - Rocklua error splash don't display part or full filename when
    it is non-ASCII
    FS#13754 - Rocklua error splash don't reset gui settings (bg, fg and font)
    
    when using signed char unicode codepoints can show up as < '0'
    code was looking to remove control chars < ' ' which also removed
    unicode code points in the process
    
    Change-Id: I48074a7854f2bee195ca554e1f86505fe5567db6

diff --git a/apps/plugins/lua/rockaux.c b/apps/plugins/lua/rockaux.c
index 7eb5ff0d28..e82471ddaf 100644
--- a/apps/plugins/lua/rockaux.c
+++ b/apps/plugins/lua/rockaux.c
@@ -27,7 +27,7 @@
 #ifdef PLUGIN
 #include "plugin.h"
 #include "lib/pluginlib_actions.h"
-#define lcd_getstringsize rb->lcd_getstringsize
+#define font_getstringsize rb->font_getstringsize
 #define lcd_clear_display rb->lcd_clear_display
 #define lcd_putsxy        rb->lcd_putsxy
 #define lcd_update        rb->lcd_update
@@ -66,7 +66,13 @@ int splash_scroller(int timeout, const char* str)
     if (!str)
         str = "[nil]";
     int w, ch_w, ch_h;
-    lcd_getstringsize("W", &ch_w, &ch_h);
+
+    struct viewport vp;
+    rb->viewport_set_defaults(&vp, SCREEN_MAIN);
+    struct viewport *last_vp = rb->lcd_set_viewport(&vp);
+    int fontnum = vp.font;
+
+    font_getstringsize("W", &ch_w, &ch_h, fontnum);
 
     const int max_w = LCD_WIDTH - (ch_w * 2);
     const int max_lines = LCD_HEIGHT / ch_h - 1;
@@ -103,13 +109,13 @@ int splash_scroller(int timeout, const char* str)
                 line[linepos] = ' ';
                 beep_play(1000, HZ, 1000);
             }
-            else if (ch[0] < ' ') /* Dont copy control characters */
+            else if (ch[0] < ' ' && ch[0] > '\0') /* Dont copy control characters */
                 line[linepos] = (linepos == 0) ? '\0' : ' ';
             else
                 line[linepos] = ch[0];
 
             line[linepos + 1] = '\0'; /* terminate to check text extent */
-            lcd_getstringsize(line, &w, NULL);
+            font_getstringsize(line, &w, NULL, fontnum);
 
             /* try to not split in middle of words */
             if (w + wrap_thresh >= max_w &&
@@ -174,6 +180,8 @@ int splash_scroller(int timeout, const char* str)
         else
             break;
     }
+    rb->lcd_set_viewport(last_vp);
+
     return action;
 }
 
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.