@@ -104,29 +104,26 @@ class ParametrizedStyles(private val view: EnrichedTextInputView) {
104104 return Triple (result, start, end)
105105 }
106106
107- private fun detectLinkConflicts (): Boolean {
108- val mergingConfig = EnrichedSpans .getMergingConfigForStyle(EnrichedSpans .LINK , view.htmlStyle)? : return false
107+ private fun canLinkBeApplied (): Boolean {
108+ val mergingConfig = EnrichedSpans .getMergingConfigForStyle(EnrichedSpans .LINK , view.htmlStyle)? : return true
109109 val conflictingStyles = mergingConfig.conflictingStyles
110110 val blockingStyles = mergingConfig.blockingStyles
111111
112112 for (style in blockingStyles) {
113- if (view.spanState?.getStart(style) != null ) return true
113+ if (view.spanState?.getStart(style) != null ) return false
114114 }
115115
116116 for (style in conflictingStyles) {
117- if (view.spanState?.getStart(style) != null ) return true
117+ if (view.spanState?.getStart(style) != null ) return false
118118 }
119119
120- return false
120+ return true
121121 }
122122
123123 private fun afterTextChangedLinks (result : Triple <String , Int , Int >) {
124- if (detectLinkConflicts()) {
125- return
126- }
127-
128124 // Do not detect link if it's applied manually
129- if (isSettingLinkSpan) return
125+ if (isSettingLinkSpan || ! canLinkBeApplied()) return
126+
130127 val spannable = view.text as Spannable
131128 val (word, start, end) = result
132129
0 commit comments