about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-10-20 22:02:35 +0200
committerbptato <nincsnevem662@gmail.com>2023-10-20 22:02:52 +0200
commit5b73807e4ea3ddb1a4a0d3939339b0698a1f7e32 (patch)
treee0abeadec684b5b0b8a900390f696426f6091246
parent3c3f0f1035d7b71d1993c38ca630095699972f61 (diff)
downloadchawan-5b73807e4ea3ddb1a4a0d3939339b0698a1f7e32.tar.gz
term: replace control chars in setTitle
-rw-r--r--src/display/term.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/display/term.nim b/src/display/term.nim
index 792e8a5d..605361bd 100644
--- a/src/display/term.nim
+++ b/src/display/term.nim
@@ -115,7 +115,7 @@ var goutfile: File
 proc putc(c: char): cint {.cdecl.} =
   goutfile.write(c)
 
-proc write*(term: Terminal, s: string) =
+proc write(term: Terminal, s: string) =
   when termcap_found:
     discard tputs(cstring(s), cint(s.len), putc)
   else:
@@ -360,6 +360,10 @@ proc windowChange*(term: Terminal, attrs: WindowAttributes) =
 
 proc setTitle*(term: Terminal, title: string) =
   if term.set_title:
+    let title = if Controls in title:
+      title.replaceControls()
+    else:
+      title
     term.outfile.write(XTERM_TITLE(title))
 
 proc processOutputString*(term: Terminal, str: string, w: var int): string =