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

Correct several minor bugs

parent aaef0286
Branches
Tags
No related merge requests found
......@@ -84,8 +84,8 @@ class Editor(
val end = Math.min(
s.length, previous.range.start + previous.completion.name.length + suffix.length
)
val sequence = if (end > previous.range.start) "" else s.substring(previous.range.start,
end)
val sequence = if (end < previous.range.start) ""
else s.substring(previous.range.start, end)
if (sequence == previous.completion.name + suffix) {
previous.originalWord to (previous.range.start until end)
} else {
......@@ -319,7 +319,8 @@ class Editor(
TooltipCompat.setTooltipText(clearButton, clearButton.contentDescription)
chatline.setOnKeyListener { _, keyCode, event ->
if (event.isCtrlPressed && !event.isAltPressed && event.action == KeyEvent.ACTION_DOWN) when (keyCode) {
if (event.action == KeyEvent.ACTION_DOWN) {
if (event.isCtrlPressed && !event.isAltPressed) when (keyCode) {
KeyEvent.KEYCODE_B -> {
formatHandler.toggleBold(chatline.selection)
updateButtons(chatline.selection)
......@@ -354,6 +355,7 @@ class Editor(
}
else -> false
}
} else false
}
}
......
......@@ -10,8 +10,10 @@ object IrcCaseMappers {
fun equalsIgnoreCase(a: String, b: String): Boolean
fun toLowerCase(value: String): String
fun toLowerCaseNullable(value: String?): String? = value?.let(this@IrcCaseMapper::toLowerCase)
fun toUpperCase(value: String): String
fun toUpperCaseNullable(value: String?): String? = value?.let(this@IrcCaseMapper::toUpperCase)
}
internal class UnicodeCaseMapper : IrcCaseMapper {
......@@ -32,11 +34,17 @@ object IrcCaseMappers {
internal class ClassicalIrcCaseMapper :
IrcCaseMapper {
override fun toLowerCase(value: String): String {
return value.toLowerCase(Locale.US).replace('[', '{').replace(']', '}').replace('^', '~')
return value.toLowerCase(Locale.US)
.replace('[', '{')
.replace(']', '}')
.replace('^', '~')
}
override fun toUpperCase(value: String): String {
return value.toUpperCase(Locale.US).replace('{', '[').replace('}', ']').replace('~', '^')
return value.toUpperCase(Locale.US)
.replace('{', '[')
.replace('}', ']')
.replace('~', '^')
}
override fun equalsIgnoreCase(a: String, b: String): Boolean {
......
......@@ -18,6 +18,7 @@ import de.kuschku.libquassel.util.Optional
import de.kuschku.libquassel.util.flag.and
import de.kuschku.libquassel.util.flag.hasFlag
import de.kuschku.libquassel.util.helpers.*
import de.kuschku.libquassel.util.irc.IrcCaseMappers
import de.kuschku.quasseldroid.util.helper.combineLatest
import de.kuschku.quasseldroid.util.helper.switchMapNotNull
import de.kuschku.quasseldroid.util.helper.toLiveData
......@@ -511,7 +512,7 @@ class QuasselViewModel : ViewModel() {
it.info.type.hasFlag(Buffer_Type.StatusBuffer)
}.let {
if (config.sortAlphabetically())
it.sortedBy { it.info.bufferName }
it.sortedBy { IrcCaseMappers.unicode.toLowerCaseNullable(it.info.bufferName) }
.sortedByDescending { it.hiddenState == BufferHiddenState.VISIBLE }
else it
}.distinctBy { it.info.bufferId }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment