Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
0656045d
Commit
0656045d
authored
Sep 08, 2019
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix format overload that takes text_style (#1305)
parent
c85ae23c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
include/fmt/color.h
include/fmt/color.h
+3
-2
test/color-test.cc
test/color-test.cc
+3
-1
No files found.
include/fmt/color.h
View file @
0656045d
...
...
@@ -576,8 +576,9 @@ inline std::basic_string<Char> vformat(
template
<
typename
S
,
typename
...
Args
,
typename
Char
=
char_t
<
S
>
>
inline
std
::
basic_string
<
Char
>
format
(
const
text_style
&
ts
,
const
S
&
format_str
,
const
Args
&
...
args
)
{
return
internal
::
vformat
(
ts
,
to_string_view
(
format_str
),
{
internal
::
make_args_checked
(
format_str
,
args
...)});
return
internal
::
vformat
(
ts
,
to_string_view
(
format_str
),
{
internal
::
make_args_checked
<
Args
...
>
(
format_str
,
args
...)});
}
FMT_END_NAMESPACE
...
...
test/color-test.cc
View file @
0656045d
...
...
@@ -47,7 +47,7 @@ TEST(ColorsTest, ColorsPrint) {
"
\x1b
[105mtbmagenta
\x1b
[0m"
);
}
TEST
(
ColorsTest
,
Colors
Format
)
{
TEST
(
ColorsTest
,
Format
)
{
EXPECT_EQ
(
fmt
::
format
(
fg
(
fmt
::
rgb
(
255
,
20
,
30
)),
"rgb(255,20,30)"
),
"
\x1b
[38;2;255;020;030mrgb(255,20,30)
\x1b
[0m"
);
EXPECT_EQ
(
fmt
::
format
(
fg
(
fmt
::
color
::
blue
),
"blue"
),
...
...
@@ -78,4 +78,6 @@ TEST(ColorsTest, ColorsFormat) {
"
\x1b
[92mtbgreen
\x1b
[0m"
);
EXPECT_EQ
(
fmt
::
format
(
bg
(
fmt
::
terminal_color
::
bright_magenta
),
"tbmagenta"
),
"
\x1b
[105mtbmagenta
\x1b
[0m"
);
EXPECT_EQ
(
fmt
::
format
(
fg
(
fmt
::
terminal_color
::
red
),
"{}"
,
"foo"
),
"
\x1b
[31mfoo
\x1b
[0m"
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment