Skip to content
GitLab
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
ab9ac8d6
Commit
ab9ac8d6
authored
Nov 16, 2021
by
Tomaz Canabrava
Browse files
Move last method to Character
parent
721bc4a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/characters/Character.h
View file @
ab9ac8d6
...
...
@@ -12,6 +12,7 @@
#include
"CharacterColor.h"
#include
"CharacterWidth.h"
#include
"ExtendedCharTable.h"
#include
"LineBlockCharacters.h"
// Qt
#include
<QVector>
...
...
@@ -195,6 +196,12 @@ public:
{
return
(
lhs
.
rendition
&
~
RE_EXTENDED_CHAR
)
==
(
rendition
&
~
RE_EXTENDED_CHAR
);
};
inline
bool
hasSameLineDrawStatus
(
const
Character
&
lhs
)
const
{
const
bool
lineDraw
=
LineBlockCharacters
::
canDraw
(
character
);
return
LineBlockCharacters
::
canDraw
(
lhs
.
character
)
==
lineDraw
;
};
};
constexpr
bool
operator
==
(
const
Character
&
a
,
const
Character
&
b
)
...
...
src/terminalDisplay/TerminalPainter.cpp
View file @
ab9ac8d6
...
...
@@ -94,7 +94,6 @@ void TerminalPainter::drawContents(Character *image,
}
// TODO: Move all those lambdas to Character, so it's easy to test.
const
bool
lineDraw
=
LineBlockCharacters
::
canDraw
(
image
[
display
->
loc
(
x
,
y
)].
character
);
const
bool
doubleWidth
=
(
image
[
qMin
(
display
->
loc
(
x
,
y
)
+
1
,
imageSize
-
1
)].
character
==
0
);
const
auto
isInsideDrawArea
=
[
&
](
int
column
)
{
...
...
@@ -105,9 +104,6 @@ void TerminalPainter::drawContents(Character *image,
const
int
characterLoc
=
qMin
(
display
->
loc
(
column
,
y
)
+
1
,
imageSize
-
1
);
return
(
image
[
characterLoc
].
character
==
0
)
==
doubleWidth
;
};
const
auto
hasSameLineDrawStatus
=
[
&
](
int
column
)
{
return
LineBlockCharacters
::
canDraw
(
image
[
display
->
loc
(
column
,
y
)].
character
)
==
lineDraw
;
};
const
Character
&
char_value
=
image
[
display
->
loc
(
x
,
y
)];
...
...
@@ -116,7 +112,8 @@ void TerminalPainter::drawContents(Character *image,
Character
next_char
=
image
[
display
->
loc
(
x
+
len
,
y
)];
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
))
{
||
!
char_value
.
hasSameLineDrawStatus
(
next_char
)
||
!
char_value
.
isSameScript
(
next_char
)
||
!
next_char
.
canBeGrouped
(
bidiEnabled
,
doubleWidth
))
{
break
;
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment