diff options
author | Docile-Alligator <chineseperson5@gmail.com> | 2022-03-29 23:27:41 +0000 |
---|---|---|
committer | Docile-Alligator <chineseperson5@gmail.com> | 2022-03-29 23:27:41 +0000 |
commit | 83b71b830402db198393970c2e75f1dc9a434d6f (patch) | |
tree | d12fb1643fa23e93ad4635f12440035d1685657f | |
parent | ac749fe0f0b2c80ac79aa4b889c15c36ea1d5994 (diff) | |
download | infinity-for-reddit-83b71b830402db198393970c2e75f1dc9a434d6f.tar infinity-for-reddit-83b71b830402db198393970c2e75f1dc9a434d6f.tar.gz infinity-for-reddit-83b71b830402db198393970c2e75f1dc9a434d6f.tar.bz2 infinity-for-reddit-83b71b830402db198393970c2e75f1dc9a434d6f.tar.lz infinity-for-reddit-83b71b830402db198393970c2e75f1dc9a434d6f.tar.xz infinity-for-reddit-83b71b830402db198393970c2e75f1dc9a434d6f.tar.zst infinity-for-reddit-83b71b830402db198393970c2e75f1dc9a434d6f.zip |
Fix spoiler not rendering last two characters.
Diffstat (limited to '')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/markdown/SpoilerParserPlugin.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/SpoilerParserPlugin.java b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/SpoilerParserPlugin.java index 90e439b0..d1dde6f2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/SpoilerParserPlugin.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/SpoilerParserPlugin.java @@ -89,7 +89,7 @@ public class SpoilerParserPlugin extends AbstractMarkwonPlugin { int offset = 2; for (Pair<Integer, Integer> spoiler : spoilers) { int spoilerStart = spoiler.first - offset; - int spoilerEnd = spoiler.second - offset; + int spoilerEnd = spoiler.second - offset + 2; // Try not to set a spoiler span if it's inside a CodeSpan CodeSpan[] codeSpans = markdownStringBuilder.getSpans(spoilerStart, spoilerEnd, CodeSpan.class); @@ -99,7 +99,7 @@ public class SpoilerParserPlugin extends AbstractMarkwonPlugin { markdownStringBuilder.delete(spoilerEnd, spoilerEnd + 2); markdownStringBuilder.delete(spoilerStart, spoilerStart + 2); SpoilerSpan spoilerSpan = new SpoilerSpan(textColor, backgroundColor); - markdownStringBuilder.setSpan(spoilerSpan, spoilerStart, spoilerEnd, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + markdownStringBuilder.setSpan(spoilerSpan, spoilerStart, spoilerEnd - 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); offset += 4; continue; } @@ -111,7 +111,7 @@ public class SpoilerParserPlugin extends AbstractMarkwonPlugin { markdownStringBuilder.delete(spoilerEnd, spoilerEnd + 2); markdownStringBuilder.delete(spoilerStart, spoilerStart + 2); SpoilerSpan spoilerSpan = new SpoilerSpan(textColor, backgroundColor); - markdownStringBuilder.setSpan(spoilerSpan, spoilerStart, spoilerEnd, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + markdownStringBuilder.setSpan(spoilerSpan, spoilerStart, spoilerEnd - 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); offset += 4; } else { break; @@ -125,7 +125,7 @@ public class SpoilerParserPlugin extends AbstractMarkwonPlugin { markdownStringBuilder.delete(spoilerEnd, spoilerEnd + 2); markdownStringBuilder.delete(spoilerStart, spoilerStart + 2); SpoilerSpan spoilerSpan = new SpoilerSpan(textColor, backgroundColor); - markdownStringBuilder.setSpan(spoilerSpan, spoilerStart, spoilerEnd, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + markdownStringBuilder.setSpan(spoilerSpan, spoilerStart, spoilerEnd - 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); offset += 4; } else { break; |