aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/render/rendertext.nim4
-rw-r--r--src/types/url.nim2
-rw-r--r--src/utils/twtstr.nim29
3 files changed, 4 insertions, 31 deletions
diff --git a/src/render/rendertext.nim b/src/render/rendertext.nim
index 675c4ddb..a43a50c5 100644
--- a/src/render/rendertext.nim
+++ b/src/render/rendertext.nim
@@ -35,7 +35,7 @@ proc renderPlainText*(text: string): FlexibleGrid =
of '\e':
i = format.parseAnsiCode(text, i)
af = true
- elif text[i].isControlChar():
+ elif text[i] in Controls:
add_format
result[^1].str &= '^' & text[i].getControlLetter()
else:
@@ -92,7 +92,7 @@ proc renderStream*(grid: var FlexibleGrid, renderer: var StreamRenderer, len: in
renderer.spaces = 0
of '\e':
renderer.ansiparser.reset()
- elif c.isControlChar():
+ elif c in Controls:
add_format
grid[^1].str &= '^' & c.getControlLetter()
else:
diff --git a/src/types/url.nim b/src/types/url.nim
index 1476a566..da27d96b 100644
--- a/src/types/url.nim
+++ b/src/types/url.nim
@@ -287,7 +287,7 @@ func domainToAscii*(domain: string, bestrict = false): Option[string] =
return none(string)
return result
else:
- return domain.toAsciiLower().some
+ return domain.tolower().some
func parseHost(input: string, isnotspecial = false): Option[Host] =
if input.len == 0: return
diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim
index 3d33f8d1..0bce4591 100644
--- a/src/utils/twtstr.nim
+++ b/src/utils/twtstr.nim
@@ -46,9 +46,6 @@ func onlyWhitespace*(s: string): bool =
return false
return true
-func isControlChar*(c: char): bool =
- return c in Controls
-
func isControlChar*(r: Rune): bool =
case r
of Rune(0x00)..Rune(0x1F): return true
@@ -82,25 +79,6 @@ const controlLetterMap = genControlLetterMap()
func getControlLetter*(c: char): char =
return controlLetterMap[int(c)]
-func findChar*(str: string, c: char, start: int = 0): int =
- var i = start
- while i < str.len:
- if str[i] == c:
- return i
- inc i
- return -1
-
-func findChar*(str: string, c: Rune, start: int = 0): int =
- var i = start
- var n = i
- while i < str.runeLen():
- var r: Rune
- fastRuneAt(str, n, r)
- if r == c:
- return i
- i = n
- return -1
-
const lowerChars = (func(): array[char, char] =
for i in 0..255:
if char(i) in 'A'..'Z':
@@ -112,11 +90,6 @@ const lowerChars = (func(): array[char, char] =
func tolower*(c: char): char =
return lowerChars[c]
-func toAsciiLower*(str: string): string =
- result = newString(str.len)
- for i in 0..str.high:
- result[i] = str[i].tolower()
-
func toHeaderCase*(str: string): string =
result = str
var flip = true
@@ -828,7 +801,7 @@ var width_table*: array[0..0x10FFFF, byte]
func makewidthtable*(cjk: bool): array[0..0x10FFFF, byte] {.noInit.} =
for r in low(char)..high(char):
- if r.isControlChar():
+ if r in Controls:
result[int(r)] = 0
else:
result[int(r)] = 1