Skip to content
Snippets Groups Projects
Commit c5b77d01 authored by Simon Glass's avatar Simon Glass Committed by Anatolij Gustschin
Browse files

video: Provide a left margin for the text console


Allow the left margin to be set so that text does not have to be right up
against the left side. On some panels this makes it hard to read.

Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
parent 5508f10a
No related branches found
No related tags found
No related merge requests found
...@@ -53,7 +53,7 @@ static void vidconsole_back(struct udevice *dev) ...@@ -53,7 +53,7 @@ static void vidconsole_back(struct udevice *dev)
struct vidconsole_priv *priv = dev_get_uclass_priv(dev); struct vidconsole_priv *priv = dev_get_uclass_priv(dev);
priv->xcur_frac -= VID_TO_POS(priv->x_charsize); priv->xcur_frac -= VID_TO_POS(priv->x_charsize);
if (priv->xcur_frac < 0) { if (priv->xcur_frac < priv->xstart_frac) {
priv->xcur_frac = (priv->cols - 1) * priv->xcur_frac = (priv->cols - 1) *
VID_TO_POS(priv->x_charsize); VID_TO_POS(priv->x_charsize);
priv->ycur -= priv->y_charsize; priv->ycur -= priv->y_charsize;
...@@ -71,7 +71,7 @@ static void vidconsole_newline(struct udevice *dev) ...@@ -71,7 +71,7 @@ static void vidconsole_newline(struct udevice *dev)
const int rows = CONFIG_CONSOLE_SCROLL_LINES; const int rows = CONFIG_CONSOLE_SCROLL_LINES;
int i; int i;
priv->xcur_frac = 0; priv->xcur_frac = priv->xstart_frac;
priv->ycur += priv->y_charsize; priv->ycur += priv->y_charsize;
/* Check if we need to scroll the terminal */ /* Check if we need to scroll the terminal */
...@@ -95,7 +95,7 @@ int vidconsole_put_char(struct udevice *dev, char ch) ...@@ -95,7 +95,7 @@ int vidconsole_put_char(struct udevice *dev, char ch)
/* beep */ /* beep */
break; break;
case '\r': case '\r':
priv->xcur_frac = 0; priv->xcur_frac = priv->xstart_frac;
break; break;
case '\n': case '\n':
vidconsole_newline(dev); vidconsole_newline(dev);
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
* @y_charsize: Character height in pixels * @y_charsize: Character height in pixels
* @tab_width_frac: Tab width in fractional units * @tab_width_frac: Tab width in fractional units
* @xsize_frac: Width of the display in fractional units * @xsize_frac: Width of the display in fractional units
* @xstart_frac: Left margin for the text console in fractional units
*/ */
struct vidconsole_priv { struct vidconsole_priv {
struct stdio_dev sdev; struct stdio_dev sdev;
...@@ -38,6 +39,7 @@ struct vidconsole_priv { ...@@ -38,6 +39,7 @@ struct vidconsole_priv {
int y_charsize; int y_charsize;
int tab_width_frac; int tab_width_frac;
int xsize_frac; int xsize_frac;
int xstart_frac;
}; };
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment