# HG changeset patch # User David Barts # Date 1662954299 25200 # Node ID 02b10142272645a45aa53f7e74bb63af018232a8 # Parent eafa3779aef8ee1b35affc16e8e7ba88ec83d92c See bugs. diff -r eafa3779aef8 -r 02b101422726 src/main/kotlin/name/blackcap/passman/See.kt --- a/src/main/kotlin/name/blackcap/passman/See.kt Sun Sep 11 20:36:06 2022 -0700 +++ b/src/main/kotlin/name/blackcap/passman/See.kt Sun Sep 11 20:44:59 2022 -0700 @@ -7,14 +7,15 @@ import java.util.Formatter private const val DELIM = '"' +private const val SHY = '\u00ad' private val STD_ESC_MAP = mapOf('\t' to 't', '\b' to 'b', '\n' to 'n', - '\r' to 'r', '\u000c' to 'f', '\"' to '"', '\\' to '\\') + '\r' to 'r', '\u000c' to 'f', '"' to '"', '\\' to '\\') +private val BANNED = setOf(DELIM, SHY, '\\') private const val MIN_ASCII = ' ' private const val MAX_ASCII = '~' private const val MIN_8859 = '\u00a1' private const val MAX_8859 = '\u00ff' -private const val SHY = '\u00ad' fun see(input: String, simple: Boolean = false): String = if (simple) seeSimple(input) else seeAggressive(input) @@ -30,7 +31,7 @@ val accum = Formatter() accum.format("%c", DELIM) for (ch in input) { - if ((ch in MIN_ASCII..MAX_ASCII) || ((ch != SHY) && (ch in MIN_8859 .. MAX_8859))) { + if ((ch !in BANNED) && ((ch in MIN_ASCII..MAX_ASCII) || (ch in MIN_8859 .. MAX_8859))) { accum.format("%c", ch) continue }