Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Konsole
Commits
01b73503
Commit
01b73503
authored
Nov 16, 2021
by
Tomaz Canabrava
Browse files
Move isSameRendition to Character
This also simplifies a bit of TerminalPainter
parent
8d9cdd1b
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/characters/Character.h
View file @
01b73503
...
...
@@ -190,6 +190,11 @@ public:
{
return
lhs
.
foregroundColor
==
foregroundColor
&&
lhs
.
backgroundColor
==
backgroundColor
;
}
inline
bool
hasSameRendition
(
const
Character
&
lhs
)
const
{
return
(
lhs
.
rendition
&
~
RE_EXTENDED_CHAR
)
==
(
rendition
&
~
RE_EXTENDED_CHAR
);
};
};
constexpr
bool
operator
==
(
const
Character
&
a
,
const
Character
&
b
)
...
...
src/terminalDisplay/TerminalPainter.cpp
View file @
01b73503
...
...
@@ -102,9 +102,6 @@ void TerminalPainter::drawContents(Character *image,
return
column
<=
rect
.
right
();
};
const
auto
hasSameRendition
=
[
&
](
int
column
)
{
return
(
image
[
display
->
loc
(
column
,
y
)].
rendition
&
~
RE_EXTENDED_CHAR
)
==
(
currentRendition
&
~
RE_EXTENDED_CHAR
);
};
const
auto
hasSameWidth
=
[
&
](
int
column
)
{
const
int
characterLoc
=
qMin
(
display
->
loc
(
column
,
y
)
+
1
,
imageSize
-
1
);
return
(
image
[
characterLoc
].
character
==
0
)
==
doubleWidth
;
...
...
@@ -119,8 +116,8 @@ void TerminalPainter::drawContents(Character *image,
while
(
isInsideDrawArea
(
x
+
len
))
{
Character
next_char
=
image
[
display
->
loc
(
x
+
len
,
y
)];
if
(
!
char_value
.
hasSameColors
(
next_char
)
||
!
hasSameRendition
(
x
+
len
)
||
!
hasSameWidth
(
x
+
len
)
||
!
hasSameLineDrawStatus
(
x
+
len
)
||
!
char_value
.
isSameScript
(
next_char
)
||
!
next_char
.
canBeGrouped
(
bidiEnabled
,
doubleWidth
))
{
if
(
!
char_value
.
hasSameColors
(
next_char
)
||
!
char_value
.
hasSameRendition
(
next_char
)
||
!
hasSameWidth
(
x
+
len
)
||
!
hasSameLineDrawStatus
(
x
+
len
)
||
!
char_value
.
isSameScript
(
next_char
)
||
!
next_char
.
canBeGrouped
(
bidiEnabled
,
doubleWidth
))
{
break
;
}
...
...
@@ -152,7 +149,7 @@ void TerminalPainter::drawContents(Character *image,
// rendering ambiguous characters with wide glyphs without clipping them.
while
(
!
doubleWidth
&&
isInsideDrawArea
(
x
+
len
))
{
const
Character
next_char
=
image
[
display
->
loc
(
x
+
len
,
y
)];
if
(
next_char
.
character
==
' '
&&
char_value
.
hasSameColors
(
next_char
)
&&
hasSameRendition
(
x
+
len
))
{
if
(
next_char
.
character
==
' '
&&
char_value
.
hasSameColors
(
next_char
)
&&
char_value
.
hasSameRendition
(
next_char
))
{
// univec intentionally not modified - trailing spaces are meaningless
len
++
;
}
...
...
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