Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
redox-os
ransid
Commits
176df21c
Commit
176df21c
authored
Nov 16, 2018
by
E5ten
Browse files
Add underline and strikethrough support.
parent
18a50799
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib.rs
View file @
176df21c
...
...
@@ -12,7 +12,9 @@ pub enum Event<'a> {
y
:
usize
,
c
:
char
,
bold
:
bool
,
italic
:
bool
,
underlined
:
bool
,
strikethrough
:
bool
,
color
:
Color
},
Input
{
...
...
@@ -63,7 +65,9 @@ pub struct State {
pub
background_default
:
Color
,
pub
bold
:
bool
,
pub
inverted
:
bool
,
pub
italic
:
bool
,
pub
underlined
:
bool
,
pub
strikethrough
:
bool
,
pub
cursor
:
bool
,
pub
redraw
:
bool
,
pub
origin
:
bool
,
...
...
@@ -93,7 +97,9 @@ impl State {
background_default
:
Color
::
Ansi
(
0
),
bold
:
false
,
inverted
:
false
,
italic
:
false
,
underlined
:
false
,
strikethrough
:
false
,
cursor
:
true
,
redraw
:
true
,
origin
:
false
,
...
...
@@ -118,7 +124,9 @@ impl State {
y
:
self
.y
,
c
:
c
,
bold
:
self
.bold
,
italic
:
self
.italic
,
underlined
:
self
.underlined
,
strikethrough
:
self
.strikethrough
,
color
:
if
self
.inverted
{
self
.background
}
else
{
self
.foreground
}
});
}
...
...
@@ -559,21 +567,36 @@ impl State {
1
=>
{
self
.bold
=
true
;
},
3
=>
{
self
.italic
=
true
;
},
4
=>
{
self
.underlined
=
true
;
},
7
=>
{
self
.inverted
=
true
;
},
9
=>
{
self
.strikethrough
=
true
;
},
}
21
=>
{
self
.bold
=
false
;
},
23
=>
{
self
.italic
=
false
;
},
}
24
=>
{
self
.underlined
=
false
;
},
27
=>
{
self
.inverted
=
false
;
},
29
=>
{
self
.strikethrough
=
false
;
},
}
30
...
37
=>
self
.foreground
=
Color
::
Ansi
(
*
value
as
u8
-
30
),
38
=>
match
value_iter
.next
()
.map
(|
v
|
*
v
)
.unwrap_or
(
0
)
{
2
=>
{
...
...
Write
Preview
Supports
Markdown
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