Skip to content
Snippets Groups Projects
Commit 0e668ac3 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Fixed an issue rendering certain mIRC colors

parent 2bc5f589
No related branches found
No related tags found
No related merge requests found
...@@ -361,13 +361,13 @@ class IrcFormatDeserializer(private val context: Context) { ...@@ -361,13 +361,13 @@ class IrcFormatDeserializer(private val context: Context) {
private inner class ColorIrcFormat(val foreground: Byte, val background: Byte) : IrcFormat { private inner class ColorIrcFormat(val foreground: Byte, val background: Byte) : IrcFormat {
override fun applyTo(editable: SpannableStringBuilder, from: Int, to: Int) { override fun applyTo(editable: SpannableStringBuilder, from: Int, to: Int) {
if (foreground.toInt() > 0 && foreground.toInt() < mircColors.size) { if (foreground.toInt() >= 0 && foreground.toInt() < mircColors.size) {
editable.setSpan( editable.setSpan(
IrcForegroundColorSpan(foreground.toInt(), mircColors[foreground.toInt()]), from, to, IrcForegroundColorSpan(foreground.toInt(), mircColors[foreground.toInt()]), from, to,
Spanned.SPAN_INCLUSIVE_EXCLUSIVE Spanned.SPAN_INCLUSIVE_EXCLUSIVE
) )
} }
if (background.toInt() > 0 && background.toInt() < mircColors.size) { if (background.toInt() >= 0 && background.toInt() < mircColors.size) {
editable.setSpan( editable.setSpan(
IrcBackgroundColorSpan(background.toInt(), mircColors[background.toInt()]), from, to, IrcBackgroundColorSpan(background.toInt(), mircColors[background.toInt()]), from, to,
Spanned.SPAN_INCLUSIVE_EXCLUSIVE Spanned.SPAN_INCLUSIVE_EXCLUSIVE
......
...@@ -17,6 +17,6 @@ object ClientInitSerializer : HandshakeMessageSerializer<HandshakeMessage.Client ...@@ -17,6 +17,6 @@ object ClientInitSerializer : HandshakeMessageSerializer<HandshakeMessage.Client
override fun deserialize(data: QVariantMap) = HandshakeMessage.ClientInit( override fun deserialize(data: QVariantMap) = HandshakeMessage.ClientInit(
clientVersion = data["ClientVersion"].value(), clientVersion = data["ClientVersion"].value(),
buildDate = data["ClientDate"].value(), buildDate = data["ClientDate"].value(),
clientFeatures = Flags.Companion.of(data["Features"].value(0)) clientFeatures = Flags.of(data["Features"].value(0))
) )
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment