Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Niklas Roy
firmware
Commits
65efd6bc
Commit
65efd6bc
authored
5 years ago
by
schneider
Browse files
Options
Downloads
Plain Diff
Merge branch 'display_multiline_fix' into 'master'
fix(gfx): Break line before char is printed See merge request
!149
parents
d29f8f95
73876f4b
Branches
genofire
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/gfx/gfx.c
+13
-5
13 additions, 5 deletions
lib/gfx/gfx.c
with
13 additions
and
5 deletions
lib/gfx/gfx.c
+
13
−
5
View file @
65efd6bc
...
@@ -86,17 +86,25 @@ void gfx_puts(
...
@@ -86,17 +86,25 @@ void gfx_puts(
Color
fg
,
Color
fg
,
Color
bg
Color
bg
)
{
)
{
// iterate over the string
while
(
*
str
)
{
while
(
*
str
)
{
gfx_putchar
(
font
,
r
,
x
,
y
,
*
str
,
fg
,
bg
);
// if the current position plus the width of the next character
str
++
;
// would bring us outside of the display ...
if
((
x
+
font
->
Width
)
>
r
->
width
)
{
x
+=
font
->
Width
;
// ... we move down a line before printing the character
if
(
x
>=
r
->
width
)
{
x
=
0
;
x
=
0
;
y
+=
font
->
Height
;
y
+=
font
->
Height
;
}
}
// if the line is outside the display we return
if
(
y
>=
r
->
height
)
if
(
y
>=
r
->
height
)
return
;
return
;
// now print the character
gfx_putchar
(
font
,
r
,
x
,
y
,
*
str
,
fg
,
bg
);
str
++
;
// move along on the x axis to get the position of the next character
x
+=
font
->
Width
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment