Index: apps/screen_access.c
===================================================================
--- apps/screen_access.c	(revision 12944)
+++ apps/screen_access.c	(working copy)
@@ -45,7 +45,8 @@
             screen->height=LCD_REMOTE_HEIGHT;
             screen->setmargins=&lcd_remote_setmargins;
             screen->getymargin=&lcd_remote_getymargin;
-            screen->getxmargin=&lcd_remote_getxmargin;
+            screen->getleftmargin=&lcd_remote_getleftmargin;
+            screen->getrightmargin=&lcd_remote_getrightmargin;
             screen->getstringsize=&lcd_remote_getstringsize;
 #if 1 /* all remote LCDs are bitmapped so far */
             screen->setfont=&lcd_remote_setfont;
@@ -118,9 +119,10 @@
             screen->height=LCD_HEIGHT;
             screen->setmargins=&lcd_setmargins;
             screen->getymargin=&lcd_getymargin;
-            screen->getxmargin=&lcd_getxmargin;
             screen->getstringsize=&lcd_getstringsize;
 #ifdef HAVE_LCD_BITMAP
+            screen->getleftmargin=&lcd_getleftmargin;
+            screen->getrightmargin=&lcd_getrightmargin;
             screen->setfont=&lcd_setfont;
             screen->setfont(FONT_UI);
             screen->mono_bitmap=&lcd_mono_bitmap;
Index: apps/playlist.c
===================================================================
--- apps/playlist.c	(revision 12944)
+++ apps/playlist.c	(working copy)
@@ -479,9 +479,9 @@
     
 #ifdef HAVE_LCD_BITMAP
     if(global_settings.statusbar)
-        lcd_setmargins(0, STATUSBAR_HEIGHT);
+        lcd_setmargins(0, LCD_WIDTH, STATUSBAR_HEIGHT);
     else
-        lcd_setmargins(0, 0);
+        lcd_setmargins(0, LCD_WIDTH, 0);
 #endif
 
     gui_syncsplash(0, str(LANG_PLAYLIST_LOAD));
@@ -1658,9 +1658,9 @@
 
 #ifdef HAVE_LCD_BITMAP
     if(global_settings.statusbar)
-        lcd_setmargins(0, STATUSBAR_HEIGHT);
+        lcd_setmargins(0, LCD_WIDTH, STATUSBAR_HEIGHT);
     else
-        lcd_setmargins(0, 0);
+        lcd_setmargins(0, LCD_WIDTH, 0);
 #endif
 
     gui_syncsplash(0, fmt, count,
Index: apps/screens.c
===================================================================
--- apps/screens.c	(revision 12944)
+++ apps/screens.c	(working copy)
@@ -643,7 +643,7 @@
     struct option_select left_option;
     struct option_select bottom_option;
     struct option_select right_option;
-    int oldrepeat, old_x_margin, old_y_margin;
+    int oldrepeat, old_left_margin, old_right_margin, old_y_margin;
 
     static const struct opt_items left_items[] = {
         [0]={ STR(LANG_SYSFONT_OFF) },
@@ -666,9 +666,10 @@
     };
     struct gui_quickscreen qs;
 
-    old_x_margin = lcd_getxmargin();
+    old_left_margin = lcd_getleftmargin();
+    old_right_margin = lcd_getrightmargin();
     old_y_margin = lcd_getymargin();
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
 
     option_select_init_items(&left_option,
                              (char *)str(LANG_SYSFONT_SHUFFLE),
@@ -709,7 +710,7 @@
         }
         settings_save();
     }
-    lcd_setmargins(old_x_margin, old_y_margin);
+    lcd_setmargins(old_left_margin, old_right_margin, old_y_margin);
     return(res);
 }
 
@@ -732,7 +733,7 @@
     struct option_select left_option;
     struct option_select bottom_option;
     struct option_select right_option;
-    int old_x_margin, old_y_margin;
+    int old_left_margin, old_right_margin, old_y_margin;
 
     static const struct opt_items onoff_items[] = {
         [0]={ STR(LANG_SYSFONT_OFF) },
@@ -745,9 +746,10 @@
 
     struct gui_quickscreen qs;
 
-    old_x_margin = lcd_getxmargin();
+    old_left_margin = lcd_getrightmargin();
+    old_right_margin = lcd_getleftmargin();
     old_y_margin = lcd_getymargin();
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
 
     option_select_init_items(&left_option,
                              str(LANG_SYSFONT_SCROLL_BAR),
@@ -769,7 +771,7 @@
     res=gui_syncquickscreen_run(&qs, button_enter);
     if(!res)
         settings_save();
-    lcd_setmargins(old_x_margin, old_y_margin);
+    lcd_setmargins(old_left_margin, old_right_margin, old_y_margin);
     return(res);
 }
 #endif /* BUTTON_F3 */
@@ -876,9 +878,9 @@
 
 #ifdef HAVE_LCD_BITMAP
     if(global_settings.statusbar)
-        lcd_setmargins(0, STATUSBAR_HEIGHT);
+        lcd_setmargins(0, LCD_WIDTH, STATUSBAR_HEIGHT);
     else
-        lcd_setmargins(0, 0);
+        lcd_setmargins(0, LCD_WIDTH, 0);
 #endif
     lcd_clear_display();
     lcd_puts_scroll(0, 0, string);
@@ -1268,9 +1270,9 @@
     FOR_NB_SCREENS(i)
     {
         if(global_settings.statusbar)
-            screens[i].setmargins(0, STATUSBAR_HEIGHT);
+            screens[i].setmargins(0, screens[i].width, STATUSBAR_HEIGHT);
         else
-            screens[i].setmargins(0, 0);
+            screens[i].setmargins(0, screens[i].width, 0);
     }
 #endif
     while(!done)
Index: apps/screen_access.h
===================================================================
--- apps/screen_access.h	(revision 12944)
+++ apps/screen_access.h	(working copy)
@@ -60,8 +60,9 @@
 #ifdef HAS_BUTTONBAR
     bool has_buttonbar;
 #endif
-    void (*setmargins)(int x, int y);
-    int (*getxmargin)(void);
+    void (*setmargins)(int x1, int x2, int y);
+    int (*getleftmargin)(void);
+    int (*getrightmargin)(void);
     int (*getymargin)(void);
 
     int (*getstringsize)(const unsigned char *str, int *w, int *h);
@@ -154,10 +155,10 @@
 /*
  * Sets the x margin in pixels for the given screen
  * - screen : the screen structure
- * - xmargin : the number of pixels to the left of the screen
+ * - leftmargin : the number of pixels to the left of the screen
  */
 #define screen_set_xmargin(screen, xmargin) \
-    (screen)->setmargins(xmargin, (screen)->getymargin());
+    (screen)->setmargins(xmargin, (screen)->width, (screen)->getymargin());
 
 /*
  * Sets the y margin in pixels for the given screen
@@ -165,7 +166,7 @@
  * - xmargin : the number of pixels to the top of the screen
  */
 #define screen_set_ymargin(screen, ymargin) \
-    (screen)->setmargins((screen)->getxmargin(), ymargin);
+    (screen)->setmargins((screen)->getleftmargin(), (screen)->width, ymargin);
 
 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD)
 /*
Index: apps/recorder/recording.c
===================================================================
--- apps/recorder/recording.c	(revision 12944)
+++ apps/recorder/recording.c	(working copy)
@@ -855,7 +855,7 @@
     {
         screens[i].setfont(FONT_SYSFIXED);
         screens[i].getstringsize("M", &w, &h);
-        screens[i].setmargins(global_settings.invert_cursor ? 0 : w, 8);
+        screens[i].setmargins(global_settings.invert_cursor ? 0 : w, screens[i].width, 8);
         filename_offset[i] = ((screens[i].height >= 80) ? 1 : 0);
         pm_y[i] = 8 + h * (2 + filename_offset[i]);
     }
@@ -1251,7 +1251,7 @@
                         {
                             screens[i].setfont(FONT_SYSFIXED);
                             screens[i].setmargins(
-                                global_settings.invert_cursor ? 0 : w, 8);
+                                global_settings.invert_cursor ? 0 : w, screens[i].width, 8);
                         }
                     }
                 }
Index: apps/plugins/solitaire.c
===================================================================
--- apps/plugins/solitaire.c	(revision 12944)
+++ apps/plugins/solitaire.c	(working copy)
@@ -648,7 +648,7 @@
                 break;
 
             case 3:
-                rb->lcd_setmargins(0, 0);
+                rb->lcd_setmargins(0, LCD_WIDTH, 0);
                 if (solitaire_help() == HELP_USB)
                     result = MENU_USB;
                 break;
@@ -663,7 +663,7 @@
         }
     }
     rb->menu_exit(m);
-    rb->lcd_setmargins(0, 0);
+    rb->lcd_setmargins(0, LCD_WIDTH, 0);
     return result;
 }
 
Index: apps/plugins/viewer.c
===================================================================
--- apps/plugins/viewer.c	(revision 12944)
+++ apps/plugins/viewer.c	(working copy)
@@ -1287,7 +1287,7 @@
     result = rb->menu_run(m);
     rb->menu_exit(m);
 #ifdef HAVE_LCD_BITMAP
-    rb->lcd_setmargins(0,0);
+    rb->lcd_setmargins(0,LCD_WIDTH,0);
 
     /* Show-scrollbar mode for current view-width mode */
     if (!ONE_SCREEN_FITS_ALL())
@@ -1329,7 +1329,7 @@
     }
     rb->menu_exit(m);
 #ifdef HAVE_LCD_BITMAP
-    rb->lcd_setmargins(0,0);
+    rb->lcd_setmargins(0,LCD_WIDTH,0);
 #endif
     viewer_draw(col);
 }
Index: apps/onplay.c
===================================================================
--- apps/onplay.c	(revision 12944)
+++ apps/onplay.c	(working copy)
@@ -1086,9 +1086,9 @@
 
 #ifdef HAVE_LCD_BITMAP
         if (global_settings.statusbar)
-            lcd_setmargins(0, STATUSBAR_HEIGHT);
+            lcd_setmargins(0, LCD_WIDTH, STATUSBAR_HEIGHT);
         else
-            lcd_setmargins(0, 0);
+            lcd_setmargins(0, LCD_WIDTH, 0);
 #endif
     }
 
Index: apps/gui/gwps-common.c
===================================================================
--- apps/gui/gwps-common.c	(revision 12944)
+++ apps/gui/gwps-common.c	(working copy)
@@ -21,6 +21,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <ctype.h>
 #include "system.h"
 #include "settings.h"
 #include "rtc.h"
@@ -1329,6 +1330,35 @@
             case 0:
                 *buf++ = '%';
                 break;
+
+            case 'm': /* margins */
+            {
+                int x1=0;
+                int x2=gwps->display->width;
+
+                fmt++;
+                if (*fmt=='|') {
+                    char *p=strchr(fmt, '|');
+                    if (p) {
+                        fmt = ++p;
+                        if (isdigit(*p)) {
+                            x1=atoi(p);
+                            p=strchr(p, '|');
+                            if (p) {
+                                fmt = ++p;
+                                if (isdigit(*p)) {
+                                    x2=atoi(p);
+                                    p=strchr(p, '|');
+                                    if (p)
+                                        fmt = ++p;
+                                }
+                            }
+                        }
+                    }
+                }
+                gwps->display->setmargins( x1, x2, gwps->display->getymargin() );
+            } break;
+
             case 'a':
                 ++fmt;
                 /* remember where the current aligned text started */
@@ -1893,7 +1923,7 @@
             else {
                 left_width = 0;
             }
-            left_xpos = 0;
+            left_xpos = display->getleftmargin();
 
             if (format_align.center != 0) {
                 display->getstringsize((unsigned char *)format_align.center,
@@ -1902,7 +1932,7 @@
             else {
                 center_width = 0;
             }
-            center_xpos=(display->width - center_width) / 2;
+            center_xpos=(display->getrightmargin()-display->getleftmargin() - center_width) / 2 + display->getleftmargin();
 
             if (format_align.right != 0) {
                 display->getstringsize((unsigned char *)format_align.right,
@@ -1911,7 +1941,7 @@
             else {
                 right_width = 0;
             }
-            right_xpos = (display->width - right_width);
+            right_xpos = (display->getrightmargin() - right_width);
 
             /* Checks for overlapping strings.
                If needed the overlapping strings will be merged, separated by a
@@ -1953,7 +1983,7 @@
                 format_align.right = format_align.center;
                 /* calculate the new width and position of the merged string */
                 right_width = center_width + space_width + right_width;
-                right_xpos = (display->width - right_width);
+                right_xpos = (display->getrightmargin() - right_width);
                 /* there is no centered string anymore */
                 center_width = 0;
             }
@@ -1964,7 +1994,7 @@
                 format_align.right = format_align.center;
                 /* calculate the new width and position of the string */
                 right_width = center_width;
-                right_xpos = (display->width - right_width);
+                right_xpos = (display->getrightmargin() - right_width);
                 /* there is no centered string anymore */
                 center_width = 0;
             }
@@ -2007,7 +2037,10 @@
                     ypos = (i*string_height)+display->getymargin();
                     update_line = true;
 
-                    if (left_width>display->width) {
+                    if ((left_width > display->width) || 
+                       (display->getrightmargin()-display->getleftmargin() < left_width) ||
+                       (display->getrightmargin()-display->getleftmargin() < center_width) ||
+                       (display->getrightmargin()-display->getleftmargin() < right_width)) {
                         display->puts_scroll(0, i,
                                              (unsigned char *)format_align.left);
                     } else {
@@ -2036,6 +2069,7 @@
                             display->putsxy(right_xpos, ypos,
                                             (unsigned char *)format_align.right);
                         }
+                        
                     }
 #else
                     display->puts_scroll(0, i, buf);
@@ -2078,6 +2112,8 @@
                         display->putsxy(right_xpos, ypos,
                                         (unsigned char *)format_align.right);
                     }
+                    
+                   
 #else
                     update_line = true;
                     display->puts(0, i, buf);
Index: apps/gui/list.c
===================================================================
--- apps/gui/list.c	(revision 12944)
+++ apps/gui/list.c	(working copy)
@@ -128,7 +128,7 @@
     int line_ypos=display->getymargin()+display->char_height*selected_line;
     if (global_settings.invert_cursor)
     {
-        int line_xpos=display->getxmargin();
+        int line_xpos=display->getleftmargin();
         display->set_drawmode(DRMODE_COMPLEMENT);
         display->fillrect(line_xpos, line_ypos, display->width,
                           display->char_height);
@@ -238,7 +238,7 @@
     int lines;
 #ifdef HAVE_LCD_BITMAP
     int item_offset;
-    int old_margin = display->getxmargin();
+    int old_margin = display->getleftmargin();
 #endif
     int start, end;
     bool partial_draw = false;
Index: apps/gui/gwps.c
===================================================================
--- apps/gui/gwps.c	(revision 12944)
+++ apps/gui/gwps.c	(working copy)
@@ -87,11 +87,10 @@
 {
     int offset = 0;
     struct wps_data *data = gwps->data;
-    if(data->wps_sb_tag && data->show_sb_on_wps)
+    if((data->wps_sb_tag && data->show_sb_on_wps) || 
+       (global_settings.statusbar && !data->wps_sb_tag))
         offset = STATUSBAR_HEIGHT;
-    else if ( global_settings.statusbar && !data->wps_sb_tag)
-        offset = STATUSBAR_HEIGHT;
-    gwps->display->setmargins(0, offset);
+    gwps->display->setmargins(0, gwps->display->width, offset);
 }
 #endif
 
Index: apps/menus/recording_menu.c
===================================================================
--- apps/menus/recording_menu.c	(revision 12944)
+++ apps/menus/recording_menu.c	(working copy)
@@ -433,7 +433,7 @@
     int exit_request = false;
     enum trigger_menu_option selected = TRIGGER_MODE;
     bool retval = false;
-    int old_x_margin[NB_SCREENS];
+    int old_left_margin[NB_SCREENS], old_right_margin[NB_SCREENS];
     int old_y_margin[NB_SCREENS];
 
 #define TRIGGER_MODE_COUNT 3
@@ -505,12 +505,13 @@
     {
         screens[i].clear_display();
 
-        old_x_margin[i] = screens[i].getxmargin();
+        old_left_margin[i] = screens[i].getleftmargin();
+        old_right_margin[i] = screens[i].getrightmargin();
         old_y_margin[i] = screens[i].getymargin();
         if(global_settings.statusbar)
-           screens[i].setmargins(0, STATUSBAR_HEIGHT);
+           screens[i].setmargins(0, screens[i].width, STATUSBAR_HEIGHT);
       else
-          screens[i].setmargins(0, 0);
+          screens[i].setmargins(0, screens[i].width, 0);
 
       screens[i].getstringsize("M", &w, &h);
 
@@ -791,7 +792,7 @@
     FOR_NB_SCREENS(i)
     {
         screens[i].setfont(FONT_UI);
-        screens[i].setmargins(old_x_margin[i], old_y_margin[i]);
+        screens[i].setmargins(old_left_margin[i], old_right_margin[i], old_y_margin[i]);
     }
     action_signalscreenchange();
     return retval;
Index: apps/menus/main_menu.c
===================================================================
--- apps/menus/main_menu.c	(revision 12944)
+++ apps/menus/main_menu.c	(working copy)
@@ -153,7 +153,7 @@
     };
 #if defined(HAVE_LCD_BITMAP)
     FOR_NB_SCREENS(i)
-        screens[i].setmargins(0, 0);
+        screens[i].setmargins(0, screens[i].width, 0);
 #endif
     while (!done)
     {
Index: apps/alarm_menu.c
===================================================================
--- apps/alarm_menu.c	(revision 12944)
+++ apps/alarm_menu.c	(working copy)
@@ -70,7 +70,7 @@
         {
             FOR_NB_SCREENS(i)
             {
-                screens[i].setmargins(0, 0);
+                screens[i].setmargins(0, screens[i].width, 0);
                 gui_textarea_clear(&screens[i]);
                 screens[i].puts(0, 3, str(LANG_ALARM_MOD_KEYS));
             }
Index: apps/plugin.c
===================================================================
--- apps/plugin.c	(revision 12944)
+++ apps/plugin.c	(working copy)
@@ -590,9 +590,9 @@
     plugin_loaded = true;
 
 #ifdef HAVE_LCD_BITMAP
-    xm = lcd_getxmargin();
+    xm = lcd_getleftmargin();
     ym = lcd_getymargin();
-    lcd_setmargins(0,0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
 
 #if LCD_DEPTH > 1
     old_backdrop = lcd_get_backdrop();
@@ -605,9 +605,9 @@
 #endif
 
 #ifdef HAVE_REMOTE_LCD
-    rxm = lcd_remote_getxmargin();
+    rxm = lcd_remote_getleftmargin();
     rym = lcd_remote_getymargin();
-    lcd_remote_setmargins(0, 0);
+    lcd_remote_setmargins(0, LCD_REMOTE_WIDTH, 0);
     lcd_remote_clear_display();
     lcd_remote_update();
 #endif
@@ -632,7 +632,7 @@
     lcd_set_drawmode(DRMODE_SOLID);
 #endif /* LCD_DEPTH */
     /* restore margins */
-    lcd_setmargins(xm,ym);
+    lcd_setmargins(xm, LCD_WIDTH, ym);
     lcd_clear_display();
     lcd_update();
 #endif /* HAVE_LCD_BITMAP */
@@ -644,7 +644,7 @@
 #else
     lcd_remote_set_drawmode(DRMODE_SOLID);
 #endif
-    lcd_remote_setmargins(rxm, rym);
+    lcd_remote_setmargins(rxm, LCD_REMOTE_WIDTH, rym);
     lcd_remote_clear_display();
     lcd_remote_update();
 #endif
Index: apps/plugin.h
===================================================================
--- apps/plugin.h	(revision 12944)
+++ apps/plugin.h	(working copy)
@@ -135,7 +135,7 @@
     /* lcd */
     void (*lcd_set_contrast)(int x);
     void (*lcd_clear_display)(void);
-    void (*lcd_setmargins)(int x, int y);
+    void (*lcd_setmargins)(int leftmargin, int rightmargin, int ymargin);
     int  (*lcd_getstringsize)(const unsigned char *str, int *w, int *h);
     void (*lcd_putsxy)(int x, int y, const unsigned char *string);
     void (*lcd_puts)(int x, int y, const unsigned char *string);
Index: apps/bookmark.c
===================================================================
--- apps/bookmark.c	(revision 12944)
+++ apps/bookmark.c	(working copy)
@@ -392,7 +392,7 @@
         FOR_NB_SCREENS(i)
         {
 #ifdef HAVE_LCD_BITMAP
-            screens[i].setmargins(0, STATUSBAR_HEIGHT);
+            screens[i].setmargins(0, screens[i].width, STATUSBAR_HEIGHT);
             screens[i].puts_scroll(0,0, str(LANG_BOOKMARK_AUTOLOAD_QUERY));
             screens[i].puts(0,1, str(LANG_CONFIRM_WITH_PLAY_RECORDER));
             screens[i].puts(0,2, str(LANG_BOOKMARK_SELECT_LIST_BOOKMARKS));
@@ -496,7 +496,7 @@
     int i;
 
     FOR_NB_SCREENS(i)
-        screens[i].setmargins(0, global_settings.statusbar
+        screens[i].setmargins(0, screens[i].width, global_settings.statusbar
             ? STATUSBAR_HEIGHT : 0);
 #endif
 
Index: apps/logfdisp.c
===================================================================
--- apps/logfdisp.c	(revision 12944)
+++ apps/logfdisp.c	(working copy)
@@ -64,7 +64,7 @@
     if(!lines)
         return false;
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_clear_display();
     
     do {
Index: apps/debug_menu.c
===================================================================
--- apps/debug_menu.c	(revision 12944)
+++ apps/debug_menu.c	(working copy)
@@ -183,7 +183,7 @@
     char buf[32];
     struct audio_debug d;
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_setfont(FONT_SYSFIXED);
 
     while(1)
@@ -255,7 +255,7 @@
 
     tick_add_task(dbg_audio_task);
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_setfont(FONT_SYSFIXED);
     while(!done)
     {
@@ -425,7 +425,7 @@
 
     system_memory_guard(oldmode);  /* re-enable memory guard */
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_setfont(FONT_SYSFIXED);
     lcd_clear_display();
 
@@ -490,7 +490,7 @@
 
     system_memory_guard(oldmode);  /* re-enable memory guard */
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_setfont(FONT_SYSFIXED);
     lcd_clear_display();
 
@@ -543,7 +543,7 @@
                           (PP_VER1 >> 24) & 0xff, (PP_VER1 >> 16) & 0xff,
                           (PP_VER1 >> 8) & 0xff, (PP_VER1) & 0xff, '\0' };
                           
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_setfont(FONT_SYSFIXED);
     lcd_clear_display();
 
@@ -744,7 +744,7 @@
     int spdif_source = spdif_get_output_source(&spdif_src_on);
     spdif_set_output_source(AUDIO_SRC_SPDIF, true);
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_clear_display();
     lcd_setfont(FONT_SYSFIXED);
 
@@ -947,7 +947,7 @@
     int adc_battery_voltage, adc_battery_level;
 
     lcd_setfont(FONT_SYSFIXED);
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_clear_display();
 
     while(1)
@@ -998,7 +998,7 @@
     char buf[128];
     int line;
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_clear_display();
     lcd_setfont(FONT_SYSFIXED);
 
@@ -1082,7 +1082,7 @@
     char buf[128];
     int line;
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_clear_display();
     lcd_setfont(FONT_SYSFIXED);
 
@@ -1169,7 +1169,7 @@
     char buf[128];
     int line;
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_clear_display();
     lcd_setfont(FONT_SYSFIXED);
 
@@ -1290,7 +1290,7 @@
     int button;
 
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_setfont(FONT_SYSFIXED);
 #endif
     lcd_clear_display();
@@ -1352,7 +1352,7 @@
     unsigned short maxv, minv;
     char buf[32];
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_setfont(FONT_SYSFIXED);
 
     while(1)
@@ -1553,7 +1553,7 @@
 
     card_name[6] = '\0';
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_setfont(FONT_SYSFIXED);
 
     while (!done)
@@ -1665,7 +1665,7 @@
     char pio3[2], pio4[2];
 
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
 #endif
 
     while(!done)
@@ -1821,7 +1821,7 @@
     int line;
     char buf[32];
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, 0, 0);
     lcd_setfont(FONT_SYSFIXED);
 
     while (!done)
@@ -1876,7 +1876,7 @@
     char buf[32];
     struct tagcache_stat *stat;
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_setfont(FONT_SYSFIXED);
 
     while (!done)
@@ -2007,7 +2007,7 @@
     bool fm_detected;
 
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
 #endif
 
     while(1)
@@ -2091,7 +2091,7 @@
 
 static bool dbg_lcd_power_off(void)
 {
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
 
     while(1)
     {
@@ -2133,7 +2133,7 @@
     enum buttonlight_selection which_led = BUTTONLIGHT_LED_ALL;
     unsigned short brightness = DEFAULT_BRIGHTNESS_SETTING;
     
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     for (;;)
     {
         int button;
@@ -2281,7 +2281,7 @@
     int lines = LCD_HEIGHT/SYSFONT_HEIGHT;
     char *str;
     bool done;
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_setfont(FONT_SYSFIXED);
     str = cpu_boost_log_getlog_first();
     while (i < count)
Index: firmware/export/lcd.h
===================================================================
--- firmware/export/lcd.h	(revision 12944)
+++ firmware/export/lcd.h	(working copy)
@@ -59,8 +59,9 @@
 extern void lcd_backlight(bool on);
 extern int  lcd_default_contrast(void);
 extern void lcd_set_contrast(int val);
-extern void lcd_setmargins(int xmargin, int ymargin);
-extern int  lcd_getxmargin(void);
+extern void lcd_setmargins(int leftmargin, int rightmargin, int ymargin);
+extern int  lcd_getleftmargin(void);
+extern int  lcd_getrightmargin(void);
 extern int  lcd_getymargin(void);
 extern int  lcd_getstringsize(const unsigned char *str, int *w, int *h);
 
@@ -399,6 +400,8 @@
     bool backward; /* scroll presently forward or backward? */
     bool bidir;
     long start_tick;
+    int left_margin;
+    int right_margin;
 };
 
 #endif /* __LCD_H__ */
Index: firmware/export/lcd-remote.h
===================================================================
--- firmware/export/lcd-remote.h	(revision 12944)
+++ firmware/export/lcd-remote.h	(working copy)
@@ -142,8 +142,9 @@
 
 extern void lcd_remote_set_drawmode(int mode);
 extern int  lcd_remote_get_drawmode(void);
-extern void lcd_remote_setmargins(int xmargin, int ymargin);
-extern int  lcd_remote_getxmargin(void);
+extern void lcd_remote_setmargins(int leftmargin, int rightmargin, int ymargin);
+extern int  lcd_remote_getleftmargin(void);
+extern int  lcd_remote_getrightmargin(void);
 extern int  lcd_remote_getymargin(void);
 extern void lcd_remote_setfont(int font);
 extern int  lcd_remote_getstringsize(const unsigned char *str, int *w, int *h);
Index: firmware/logf.c
===================================================================
--- firmware/logf.c	(revision 12944)
+++ firmware/logf.c	(working copy)
@@ -54,7 +54,7 @@
     lcd_remote_getstringsize("A", &w, &h);
     lines = LCD_REMOTE_HEIGHT/h;
     columns = LCD_REMOTE_WIDTH/w;
-    lcd_remote_setmargins(0, 0);
+    lcd_remote_setmargins(0, LCD_REMOTE_WIDTH, 0);
     lcd_remote_clear_display();
     
     index = logfindex;
Index: firmware/drivers/lcd-1bit-vert.c
===================================================================
--- firmware/drivers/lcd-1bit-vert.c	(revision 12944)
+++ firmware/drivers/lcd-1bit-vert.c	(working copy)
@@ -40,7 +40,8 @@
 unsigned char lcd_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH];
 
 static int drawmode = DRMODE_SOLID;
-static int xmargin = 0;
+static int leftmargin = 0;
+static int rightmargin = 0;
 static int ymargin = 0;
 static int curfont = FONT_SYSFIXED;
 
@@ -84,17 +85,23 @@
     return drawmode;
 }
 
-void lcd_setmargins(int x, int y)
+void lcd_setmargins(int x1, int x2, int y)
 {
-    xmargin = x;
+    leftmargin = x1;
+    rightmargin = x2;
     ymargin = y;
 }
 
-int lcd_getxmargin(void)
+int lcd_getleftmargin(void)
 {
-    return xmargin;
+    return leftmargin;
 }
 
+int lcd_getrightmargin(void)
+{
+    return rightmargin;
+}
+
 int lcd_getymargin(void)
 {
     return ymargin;
@@ -671,14 +678,17 @@
         return;
 
     lcd_getstringsize(str, &w, &h);
-    xpos = xmargin + x*w / utf8length(str);
+    xpos = leftmargin + x*w / utf8length(str);
     ypos = ymargin + y*h;
     drawmode = (style & STYLE_INVERT) ?
                (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
     lcd_putsxyofs(xpos, ypos, offset, str);
     drawmode ^= DRMODE_INVERSEVID;
     xrect = xpos + MAX(w - offset, 0);
-    lcd_fillrect(xrect, ypos, LCD_WIDTH - xrect, h);
+    lcd_fillrect(xpos + w, ypos, rightmargin - (xpos + w), h);
+    if (LCD_WIDTH>rightmargin) {
+	lcd_fillrect(rightmargin, ypos, LCD_WIDTH - rightmargin, h);
+    }
     drawmode = lastmode;
 }
 
@@ -756,7 +766,7 @@
 
     lcd_getstringsize(string, &w, &h);
 
-    if (LCD_WIDTH - x * 8 - xmargin < w) {
+    if (rightmargin - x * 8 - leftmargin < w) {
         /* prepare scroll line */
         char *end;
 
@@ -769,7 +779,7 @@
         /* scroll bidirectional or forward only depending on the string
            width */
         if ( bidir_limit ) {
-            s->bidir = s->width < (LCD_WIDTH - xmargin) *
+            s->bidir = s->width < (rightmargin - leftmargin) *
                 (100 + bidir_limit) / 100;
         }
         else
@@ -782,12 +792,14 @@
         }
 
         end = strchr(s->line, '\0');
-        strncpy(end, string, LCD_WIDTH/2);
+        strncpy(end, string, rightmargin/2);
 
         s->len = utf8length(string);
         s->offset = offset;
-        s->startx = xmargin + x * s->width / s->len;;
+        s->startx = leftmargin + x * s->width / s->len;
         s->backward = false;
+        s->left_margin=leftmargin;
+        s->right_margin=rightmargin;
         scrolling_lines |= (1<<y);
     }
     else
@@ -834,9 +846,9 @@
                     s->backward = false;
                     s->start_tick = current_tick + scroll_delay * 2;
                 }
-                if (s->offset >= s->width - (LCD_WIDTH - xpos)) {
+                if (s->offset >= s->width - (s->right_margin - xpos)) {
                     /* at end of line */
-                    s->offset = s->width - (LCD_WIDTH - xpos);
+                    s->offset = s->width - (s->right_margin - xpos);
                     s->backward = true;
                     s->start_tick = current_tick + scroll_delay * 2;
                 }
@@ -851,8 +863,12 @@
             drawmode = s->invert ?
                        (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
             lcd_putsxyofs(xpos, ypos, s->offset, s->line);
+            if (LCD_WIDTH>s->right_margin) {
+            drawmode ^= DRMODE_INVERSEVID;
+                lcd_fillrect(s->right_margin, ypos, LCD_WIDTH - s->right_margin, pf->height);
+            }
             drawmode = lastmode;
-            lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
+            lcd_update_rect(xpos, ypos, s->right_margin - xpos, pf->height);
         }
 
         sleep(scroll_ticks);
Index: firmware/drivers/lcd-2bit-vert.c
===================================================================
--- firmware/drivers/lcd-2bit-vert.c	(revision 12944)
+++ firmware/drivers/lcd-2bit-vert.c	(working copy)
@@ -54,7 +54,8 @@
 static unsigned fg_pattern IDATA_ATTR = 0xFF; /* initially black */
 static unsigned bg_pattern IDATA_ATTR = 0x00; /* initially white */
 static int drawmode = DRMODE_SOLID;
-static int xmargin = 0;
+static int leftmargin = 0;
+static int rightmargin = 0;
 static int ymargin = 0;
 static int curfont = FONT_SYSFIXED;
 
@@ -125,17 +126,25 @@
     lcd_set_background(bg_brightness);
 }
 
-void lcd_setmargins(int x, int y)
+void lcd_setmargins(int x1, int x2, int y)
 {
-    xmargin = x;
+    leftmargin = x1;
+    rightmargin = x2;
     ymargin = y;
+
 }
 
-int lcd_getxmargin(void)
+int lcd_getleftmargin(void)
 {
-    return xmargin;
+    return leftmargin;
 }
 
+int lcd_getrightmargin(void)
+{
+    return rightmargin;
+}
+
+
 int lcd_getymargin(void)
 {
     return ymargin;
@@ -1004,14 +1013,17 @@
         return;
 
     lcd_getstringsize(str, &w, &h);
-    xpos = xmargin + x*w / utf8length((char *)str);
+    xpos = leftmargin + x*w / utf8length((char *)str);
     ypos = ymargin + y*h;
     drawmode = (style & STYLE_INVERT) ?
                (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
     lcd_putsxyofs(xpos, ypos, offset, str);
     drawmode ^= DRMODE_INVERSEVID;
     xrect = xpos + MAX(w - offset, 0);
-    lcd_fillrect(xrect, ypos, LCD_WIDTH - xrect, h);
+    lcd_fillrect(xpos + w, ypos, rightmargin - (xpos + w), h);
+    if (LCD_WIDTH>rightmargin) {
+	lcd_fillrect(rightmargin, ypos, LCD_WIDTH - rightmargin, h);
+    }
     drawmode = lastmode;
 }
 
@@ -1088,7 +1100,7 @@
 
     lcd_getstringsize(string, &w, &h);
 
-    if (LCD_WIDTH - x * 8 - xmargin < w) {
+    if (rightmargin - x * 8 - leftmargin < w) {
         /* prepare scroll line */
         char *end;
 
@@ -1101,7 +1113,7 @@
         /* scroll bidirectional or forward only depending on the string
            width */
         if ( bidir_limit ) {
-            s->bidir = s->width < (LCD_WIDTH - xmargin) *
+            s->bidir = s->width < (rightmargin - leftmargin) *
                 (100 + bidir_limit) / 100;
         }
         else
@@ -1114,12 +1126,14 @@
         }
 
         end = strchr(s->line, '\0');
-        strncpy(end, (char *)string, LCD_WIDTH/2);
+        strncpy(end, (char *)string, rightmargin/2);
 
         s->len = utf8length((char *)string);
         s->offset = offset;
-        s->startx = xmargin + x * s->width / s->len;
+        s->startx = leftmargin + x * s->width / s->len;
         s->backward = false;
+        s->left_margin=leftmargin;
+        s->right_margin=rightmargin;
         scrolling_lines |= (1<<y);
     }
     else
@@ -1166,9 +1180,9 @@
                     s->backward = false;
                     s->start_tick = current_tick + scroll_delay * 2;
                 }
-                if (s->offset >= s->width - (LCD_WIDTH - xpos)) {
+                if (s->offset >= s->width - (s->right_margin - xpos)) {
                     /* at end of line */
-                    s->offset = s->width - (LCD_WIDTH - xpos);
+                    s->offset = s->width - (s->right_margin - xpos);
                     s->backward = true;
                     s->start_tick = current_tick + scroll_delay * 2;
                 }
@@ -1183,8 +1197,12 @@
             drawmode = s->invert ?
                        (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
             lcd_putsxyofs(xpos, ypos, s->offset, s->line);
+            if (LCD_WIDTH>s->right_margin) {
+            drawmode ^= DRMODE_INVERSEVID;
+                lcd_fillrect(s->right_margin, ypos, LCD_WIDTH - s->right_margin, pf->height);
+            }
             drawmode = lastmode;
-            lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
+            lcd_update_rect(xpos, ypos, s->right_margin - xpos, pf->height);
         }
 
         sleep(scroll_ticks);
Index: firmware/drivers/lcd-2bit-horz.c
===================================================================
--- firmware/drivers/lcd-2bit-horz.c	(revision 12944)
+++ firmware/drivers/lcd-2bit-horz.c	(working copy)
@@ -50,7 +50,8 @@
 static unsigned fg_pattern IDATA_ATTR = 0xFF; /* initially black */
 static unsigned bg_pattern IDATA_ATTR = 0x00; /* initially white */
 static int drawmode = DRMODE_SOLID;
-static int xmargin = 0;
+static int leftmargin = 0;
+static int rightmargin = 0;
 static int ymargin = 0;
 static int curfont = FONT_SYSFIXED;
 
@@ -122,17 +123,23 @@
     lcd_set_background(bg_brightness);
 }
 
-void lcd_setmargins(int x, int y)
+void lcd_setmargins(int x1, int x2, int y)
 {
-    xmargin = x;
+    leftmargin = x1;
+    rightmargin = x2;
     ymargin = y;
 }
 
-int lcd_getxmargin(void)
+int lcd_getleftmargin(void)
 {
-    return xmargin;
+    return leftmargin;
 }
 
+int lcd_getrightmargin(void)
+{
+    return rightmargin;
+}
+
 int lcd_getymargin(void)
 {
     return ymargin;
@@ -868,7 +875,7 @@
         return;
 
     lcd_getstringsize(str, &w, &h);
-    xpos = xmargin + x*w / utf8length((char *)str);
+    xpos = leftmargin + x*w / utf8length((char *)str);
     ypos = ymargin + y*h;
     drawmode = (style & STYLE_INVERT) ?
                (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
@@ -952,7 +959,7 @@
 
     lcd_getstringsize(string, &w, &h);
 
-    if (LCD_WIDTH - x * 8 - xmargin < w) {
+    if (LCD_WIDTH - x * 8 - leftmargin < w) {
         /* prepare scroll line */
         char *end;
 
@@ -965,7 +972,7 @@
         /* scroll bidirectional or forward only depending on the string
            width */
         if ( bidir_limit ) {
-            s->bidir = s->width < (LCD_WIDTH - xmargin) *
+            s->bidir = s->width < (LCD_WIDTH - leftmargin) *
                 (100 + bidir_limit) / 100;
         }
         else
@@ -982,7 +989,7 @@
 
         s->len = utf8length((char *)string);
         s->offset = offset;
-        s->startx = xmargin + x * s->width / s->len;;
+        s->startx = leftmargin + x * s->width / s->len;;
         s->backward = false;
         scrolling_lines |= (1<<y);
     }
Index: firmware/drivers/lcd-remote-2bit-vi.c
===================================================================
--- firmware/drivers/lcd-remote-2bit-vi.c	(revision 12944)
+++ firmware/drivers/lcd-remote-2bit-vi.c	(working copy)
@@ -50,7 +50,8 @@
 static unsigned fg_pattern IDATA_ATTR = 0xFFFF; /* initially black */
 static unsigned bg_pattern IDATA_ATTR = 0x0000; /* initially white */
 static int drawmode = DRMODE_SOLID;
-static int xmargin = 0;
+static int leftmargin = 0;
+static int rightmargin = LCD_REMOTE_WIDTH;
 static int ymargin = 0;
 static int curfont = FONT_SYSFIXED;
 
@@ -128,17 +129,23 @@
     lcd_remote_set_background(bg_brightness);
 }
 
-void lcd_remote_setmargins(int x, int y)
+void lcd_remote_setmargins(int x1, int x2, int y)
 {
-    xmargin = x;
+    leftmargin = x1;
+    rightmargin = x2;    
     ymargin = y;
 }
 
-int lcd_remote_getxmargin(void)
+int lcd_remote_getleftmargin(void)
 {
-    return xmargin;
+    return leftmargin;
 }
 
+int lcd_remote_getrightmargin(void)
+{
+    return rightmargin;
+}
+ 
 int lcd_remote_getymargin(void)
 {
     return ymargin;
@@ -1006,7 +1013,7 @@
         return;
 
     lcd_remote_getstringsize(str, &w, &h);
-    xpos = xmargin + x*w / utf8length((char *)str);
+    xpos = leftmargin + x*w / utf8length((char *)str);
     ypos = ymargin + y*h;
     drawmode = (style & STYLE_INVERT) ?
                (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
@@ -1090,7 +1097,7 @@
 
     lcd_remote_getstringsize(string, &w, &h);
 
-    if (LCD_REMOTE_WIDTH - x * 8 - xmargin < w) {
+    if (LCD_REMOTE_WIDTH - x * 8 - leftmargin < w) {
         /* prepare scroll line */
         char *end;
 
@@ -1103,7 +1110,7 @@
         /* scroll bidirectional or forward only depending on the string
            width */
         if ( bidir_limit ) {
-            s->bidir = s->width < (LCD_REMOTE_WIDTH - xmargin) *
+            s->bidir = s->width < (LCD_REMOTE_WIDTH - leftmargin) *
                 (100 + bidir_limit) / 100;
         }
         else
@@ -1120,7 +1127,7 @@
 
         s->len = utf8length((char *)string);
         s->offset = offset;
-        s->startx = xmargin + x * s->width / s->len;;
+        s->startx = leftmargin + x * s->width / s->len;;
         s->backward = false;
         scrolling_lines |= (1<<y);
     }
Index: firmware/drivers/lcd-16bit.c
===================================================================
--- firmware/drivers/lcd-16bit.c	(revision 12944)
+++ firmware/drivers/lcd-16bit.c	(working copy)
@@ -57,7 +57,8 @@
 NON_GB_STATIC unsigned fg_pattern IDATA_ATTR = LCD_DEFAULT_FG;
 NON_GB_STATIC unsigned bg_pattern IDATA_ATTR = LCD_DEFAULT_BG;
 static int drawmode = DRMODE_SOLID;
-static int xmargin = 0;
+static int leftmargin = 0;
+static int rightmargin = LCD_WIDTH;
 static int ymargin = 0;
 static int curfont = FONT_SYSFIXED;
 
@@ -136,17 +137,23 @@
     bg_pattern = bg_color;
 }
 
-void lcd_setmargins(int x, int y)
+void lcd_setmargins(int x1, int x2, int y)
 {
-    xmargin = x;
+    leftmargin = x1;
+    rightmargin = x2;
     ymargin = y;
 }
 
-int lcd_getxmargin(void)
+int lcd_getleftmargin(void)
 {
-    return xmargin;
+    return leftmargin;
 }
 
+int lcd_getrightmargin(void)
+{
+    return rightmargin;
+}
+
 int lcd_getymargin(void)
 {
     return ymargin;
@@ -827,14 +834,17 @@
         return;
 
     lcd_getstringsize(str, &w, &h);
-    xpos = xmargin + x*w / utf8length(str);
+    xpos = leftmargin + x*w / utf8length(str);
     ypos = ymargin + y*h;
     drawmode = (style & STYLE_INVERT) ?
                (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
     lcd_putsxyofs(xpos, ypos, offset, str);
     drawmode ^= DRMODE_INVERSEVID;
     xrect = xpos + MAX(w - offset, 0);
-    lcd_fillrect(xrect, ypos, LCD_WIDTH - xrect, h);
+    lcd_fillrect(xpos + w, ypos, rightmargin - (xpos + w), h);
+    if (LCD_WIDTH>rightmargin) {
+	lcd_fillrect(rightmargin, ypos, LCD_WIDTH - rightmargin, h);
+    }
     drawmode = lastmode;
 }
 
@@ -911,7 +921,7 @@
 
     lcd_getstringsize(string, &w, &h);
 
-    if (LCD_WIDTH - x * 8 - xmargin < w) {
+    if (rightmargin - x * 8 - leftmargin < w) {
         /* prepare scroll line */
         char *end;
 
@@ -924,7 +934,7 @@
         /* scroll bidirectional or forward only depending on the string
            width */
         if ( bidir_limit ) {
-            s->bidir = s->width < (LCD_WIDTH - xmargin) *
+            s->bidir = s->width < (rightmargin - leftmargin) *
                 (100 + bidir_limit) / 100;
         }
         else
@@ -937,12 +947,14 @@
         }
 
         end = strchr(s->line, '\0');
-        strncpy(end, string, LCD_WIDTH/2);
+        strncpy(end, string, rightmargin/2);
 
         s->len = utf8length(string);
         s->offset = offset;
-        s->startx = xmargin + x * s->width / s->len;
+        s->startx = leftmargin + x * s->width / s->len;
         s->backward = false;
+        s->left_margin=leftmargin;
+        s->right_margin=rightmargin;
         scrolling_lines |= (1<<y);
     }
     else
@@ -993,9 +1005,9 @@
                     s->backward = false;
                     s->start_tick = current_tick + scroll_delay * 2;
                 }
-                if (s->offset >= s->width - (LCD_WIDTH - xpos)) {
+                if (s->offset >= s->width - (s->right_margin - xpos)) {
                     /* at end of line */
-                    s->offset = s->width - (LCD_WIDTH - xpos);
+                    s->offset = s->width - (s->right_margin - xpos);
                     s->backward = true;
                     s->start_tick = current_tick + scroll_delay * 2;
                 }
@@ -1010,8 +1022,12 @@
             drawmode = s->invert ?
                        (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
             lcd_putsxyofs(xpos, ypos, s->offset, s->line);
+            if (LCD_WIDTH>s->right_margin) {
+            drawmode ^= DRMODE_INVERSEVID;
+                lcd_fillrect(s->right_margin, ypos, LCD_WIDTH - s->right_margin, pf->height);
+            }
             drawmode = lastmode;
-            lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
+            lcd_update_rect(xpos, ypos, s->right_margin - xpos, pf->height);
         }
 
         sleep(scroll_ticks);
Index: firmware/drivers/lcd-remote-1bit-v.c
===================================================================
--- firmware/drivers/lcd-remote-1bit-v.c	(revision 12944)
+++ firmware/drivers/lcd-remote-1bit-v.c	(working copy)
@@ -40,7 +40,8 @@
                                       IBSS_ATTR;
 
 static int drawmode = DRMODE_SOLID;
-static int xmargin = 0;
+static int leftmargin = 0;
+static int rightmargin = 0;
 static int ymargin = 0;
 static int curfont = FONT_SYSFIXED;
 
@@ -78,17 +79,23 @@
     return drawmode;
 }
 
-void lcd_remote_setmargins(int x, int y)
+void lcd_remote_setmargins(int x1, int x2, int y)
 {
-    xmargin = x;
+    leftmargin = x1;
+    rightmargin = x2;
     ymargin = y;
 }
 
-int lcd_remote_getxmargin(void)
+int lcd_remote_getleftmargin(void)
 {
-    return xmargin;
+    return leftmargin;
 }
 
+int lcd_remote_getrightmargin(void)
+{
+    return rightmargin;
+}
+
 int lcd_remote_getymargin(void)
 {
     return ymargin;
@@ -660,7 +667,7 @@
 void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str,
                                   int style, int offset)
 {
-    int xpos,ypos,w,h,xrect;
+    int xpos,ypos,w,h;
     int lastmode = drawmode;
 
     /* make sure scrolling is turned off on the line we are updating */
@@ -670,14 +677,16 @@
         return;
 
     lcd_remote_getstringsize(str, &w, &h);
-    xpos = xmargin + x*w / utf8length((char *)str);
+    xpos = leftmargin + x*w / utf8length((char *)str);
     ypos = ymargin + y*h;
     drawmode = (style & STYLE_INVERT) ?
                (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
     lcd_remote_putsxyofs(xpos, ypos, offset, str);
     drawmode ^= DRMODE_INVERSEVID;
-    xrect = xpos + MAX(w - offset, 0);
-    lcd_remote_fillrect(xrect, ypos, LCD_REMOTE_WIDTH - xrect, h);
+    lcd_remote_fillrect(xpos + w, ypos, rightmargin - (xpos + w), h);
+    if (LCD_REMOTE_WIDTH>rightmargin) {
+        lcd_remote_fillrect(rightmargin, ypos, LCD_WIDTH - rightmargin, h);
+    }
     drawmode = lastmode;
 }
 
@@ -754,7 +763,7 @@
 
     lcd_remote_getstringsize(string, &w, &h);
 
-    if (LCD_REMOTE_WIDTH - x * 8 - xmargin < w) {
+    if (rightmargin - x * 8 - leftmargin < w) {
         /* prepare scroll line */
         char *end;
 
@@ -767,7 +776,7 @@
         /* scroll bidirectional or forward only depending on the string
            width */
         if ( bidir_limit ) {
-            s->bidir = s->width < (LCD_REMOTE_WIDTH - xmargin) *
+            s->bidir = s->width < (rightmargin - leftmargin) *
                 (100 + bidir_limit) / 100;
         }
         else
@@ -780,12 +789,14 @@
         }
 
         end = strchr(s->line, '\0');
-        strncpy(end, (char *)string, LCD_REMOTE_WIDTH/2);
+        strncpy(end, (char *)string, rightmargin/2);
 
         s->len = utf8length((char *)string);
         s->offset = offset;
-        s->startx = xmargin + x * s->width / s->len;;
+        s->startx = leftmargin + x * s->width / s->len;;
         s->backward = false;
+        s->left_margin=leftmargin;
+        s->right_margin=rightmargin;
         scrolling_lines |= (1<<y);
     }
     else
@@ -862,9 +873,9 @@
                     s->backward = false;
                     s->start_tick = current_tick + scroll_delay * 2;
                 }
-                if (s->offset >= s->width - (LCD_REMOTE_WIDTH - xpos)) {
+                if (s->offset >= s->width - (s->right_margin - xpos)) {
                     /* at end of line */
-                    s->offset = s->width - (LCD_REMOTE_WIDTH - xpos);
+                    s->offset = s->width - (s->right_margin - xpos);
                     s->backward = true;
                     s->start_tick = current_tick + scroll_delay * 2;
                 }
@@ -879,8 +890,12 @@
             drawmode = s->invert ?
                        (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
             lcd_remote_putsxyofs(xpos, ypos, s->offset, s->line);
+            if (LCD_REMOTE_WIDTH > s->right_margin) {
+                drawmode ^= DRMODE_INVERSEVID;
+                lcd_remote_fillrect(s->right_margin, ypos, LCD_WIDTH - s->right_margin, pf->height);
+            }
             drawmode = lastmode;
-            lcd_remote_update_rect(xpos, ypos, LCD_REMOTE_WIDTH - xpos, pf->height);
+            lcd_remote_update_rect(xpos, ypos, s->right_margin - xpos, pf->height);
         }
 
         next_tick += scroll_ticks;
