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
d6cc3d4d
Commit
d6cc3d4d
authored
Dec 31, 2021
by
Luis Javier Merino
Committed by
Tomaz Canabrava
Mar 03, 2022
Browse files
Abstract away semantics of char 0 as right half of double-wide char
parent
59cf70d4
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/Screen.cpp
View file @
d6cc3d4d
...
...
@@ -1012,7 +1012,7 @@ void Screen::displayCharacter(uint c)
}
Character
&
ch
=
_screenLines
[
_cuY
][
_cuX
+
i
];
ch
.
character
=
0
;
ch
.
setRightHalfOfDoubleWide
()
;
ch
.
foregroundColor
=
_effectiveForeground
;
ch
.
backgroundColor
=
_effectiveBackground
;
ch
.
rendition
=
_effectiveRendition
;
...
...
src/characters/Character.h
View file @
d6cc3d4d
...
...
@@ -227,6 +227,16 @@ public:
{
return
hasSameColors
(
lhs
)
&&
hasSameRendition
(
lhs
)
&&
hasSameLineDrawStatus
(
lhs
)
&&
isSameScript
(
lhs
);
}
inline
bool
isRightHalfOfDoubleWide
()
const
{
return
character
==
0
;
}
inline
void
setRightHalfOfDoubleWide
()
{
character
=
0
;
}
};
constexpr
bool
operator
==
(
const
Character
&
a
,
const
Character
&
b
)
...
...
src/terminalDisplay/TerminalDisplay.cpp
View file @
d6cc3d4d
...
...
@@ -580,11 +580,11 @@ void TerminalDisplay::updateImage()
// We also take the next one into account to handle the situation
// where characters exceed their cell width.
if
(
dirtyMask
[
x
]
!=
0
)
{
if
(
newLine
[
x
+
0
].
character
==
0u
)
{
if
(
newLine
[
x
+
0
].
isRightHalfOfDoubleWide
()
)
{
continue
;
}
const
bool
lineDraw
=
LineBlockCharacters
::
canDraw
(
newLine
[
x
+
0
].
character
);
const
bool
doubleWidth
=
(
x
+
1
==
columnsToUpdate
)
?
false
:
(
newLine
[
x
+
1
].
character
==
0
);
const
bool
doubleWidth
=
(
x
+
1
==
columnsToUpdate
)
?
false
:
newLine
[
x
+
1
].
isRightHalfOfDoubleWide
(
);
const
RenditionFlags
cr
=
newLine
[
x
].
rendition
;
const
CharacterColor
clipboard
=
newLine
[
x
].
backgroundColor
;
if
(
newLine
[
x
].
foregroundColor
!=
cf
)
{
...
...
@@ -594,11 +594,11 @@ void TerminalDisplay::updateImage()
for
(
len
=
1
;
len
<
lln
;
++
len
)
{
const
Character
&
ch
=
newLine
[
x
+
len
];
if
(
ch
.
character
==
0u
)
{
if
(
ch
.
isRightHalfOfDoubleWide
()
)
{
continue
;
// Skip trailing part of multi-col chars.
}
const
bool
nextIsDoubleWidth
=
(
x
+
len
+
1
==
columnsToUpdate
)
?
false
:
(
newLine
[
x
+
len
+
1
].
character
==
0
);
const
bool
nextIsDoubleWidth
=
(
x
+
len
+
1
==
columnsToUpdate
)
?
false
:
newLine
[
x
+
len
+
1
].
isRightHalfOfDoubleWide
(
);
if
(
ch
.
foregroundColor
!=
cf
||
ch
.
backgroundColor
!=
clipboard
||
(
ch
.
rendition
&
~
RE_EXTENDED_CHAR
)
!=
(
cr
&
~
RE_EXTENDED_CHAR
)
||
(
dirtyMask
[
x
+
len
]
==
0
)
||
LineBlockCharacters
::
canDraw
(
ch
.
character
)
!=
lineDraw
||
nextIsDoubleWidth
!=
doubleWidth
)
{
...
...
src/terminalDisplay/TerminalPainter.cpp
View file @
d6cc3d4d
...
...
@@ -79,7 +79,7 @@ void TerminalPainter::drawContents(Character *image,
bool
doubleHeightLinePair
=
false
;
// Search for start of multi-column character
if
(
(
image
[
display
->
loc
(
rect
.
x
(),
y
)].
character
==
0u
)
&&
(
x
!=
0
))
{
if
(
image
[
display
->
loc
(
rect
.
x
(),
y
)].
isRightHalfOfDoubleWide
(
)
&&
(
x
!=
0
))
{
x
--
;
}
...
...
@@ -100,14 +100,13 @@ void TerminalPainter::drawContents(Character *image,
}
}
}
else
{
const
uint
c
=
char_value
.
character
;
if
(
c
!=
0u
)
{
univec
<<
c
;
if
(
!
char_value
.
isRightHalfOfDoubleWide
())
{
univec
<<
char_value
.
character
;
}
}
// TODO: Move all those lambdas to Character, so it's easy to test.
const
bool
doubleWidth
=
(
image
[
qMin
(
pos
+
1
,
imageSize
-
1
)].
character
==
0
);
const
bool
doubleWidth
=
image
[
qMin
(
pos
+
1
,
imageSize
-
1
)].
isRightHalfOfDoubleWide
(
);
const
auto
isInsideDrawArea
=
[
rectRight
=
rect
.
right
()](
int
column
)
{
return
column
<=
rectRight
;
...
...
@@ -115,7 +114,7 @@ void TerminalPainter::drawContents(Character *image,
const
auto
hasSameWidth
=
[
imageSize
,
image
,
doubleWidth
](
int
nextPos
)
{
const
int
characterLoc
=
qMin
(
nextPos
+
1
,
imageSize
-
1
);
return
(
image
[
characterLoc
].
character
==
0
)
==
doubleWidth
;
return
image
[
characterLoc
].
isRightHalfOfDoubleWide
(
)
==
doubleWidth
;
};
if
(
char_value
.
canBeGrouped
(
bidiEnabled
,
doubleWidth
))
{
...
...
@@ -166,7 +165,7 @@ void TerminalPainter::drawContents(Character *image,
}
// Adjust for trailing part of multi-column character
if
((
x
+
len
<
display
->
usedColumns
())
&&
(
image
[
display
->
loc
(
x
+
len
,
y
)].
character
==
0u
))
{
if
((
x
+
len
<
display
->
usedColumns
())
&&
image
[
display
->
loc
(
x
+
len
,
y
)].
isRightHalfOfDoubleWide
(
))
{
len
++
;
}
...
...
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