diff options
author | bptato <nincsnevem662@gmail.com> | 2023-11-21 10:49:57 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-11-21 10:49:57 +0100 |
commit | f5d31c6ae463b9e149c8e7b9222b9be9cba089e8 (patch) | |
tree | 6d55ef8fdaa9b3f783127520b227102add830de0 /src/display | |
parent | cf948921164d7d8a156de8b9d1b256da0d3e1ce7 (diff) | |
download | chawan-f5d31c6ae463b9e149c8e7b9222b9be9cba089e8.tar.gz |
bindings: find termcap on FreeBSD
pkg-config does not find termcap (or really, ncurses) here, so we have to find it ourselves.
Diffstat (limited to 'src/display')
-rw-r--r-- | src/display/term.nim | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/display/term.nim b/src/display/term.nim index cbfa07ca..57ee2213 100644 --- a/src/display/term.nim +++ b/src/display/term.nim @@ -66,10 +66,6 @@ type orig_flags2: cint orig_termios: Termios -func hascap(term: Terminal, c: TermcapCap): bool = term.tc.caps[c] != nil -func cap(term: Terminal, c: TermcapCap): string = $term.tc.caps[c] -func ccap(term: Terminal, c: TermcapCap): cstring = term.tc.caps[c] - # control sequence introducer template CSI(s: varargs[string, `$`]): string = "\e[" & s.join(';') @@ -96,6 +92,14 @@ when not termcap_found: CSI() & "K" template ED(): string = CSI() & "J" +else: + func hascap(term: Terminal, c: TermcapCap): bool = term.tc.caps[c] != nil + func cap(term: Terminal, c: TermcapCap): string = $term.tc.caps[c] + func ccap(term: Terminal, c: TermcapCap): cstring = term.tc.caps[c] + + var goutfile: File + proc putc(c: char): cint {.cdecl.} = + goutfile.write(c) template SGR*(s: varargs[string, `$`]): string = CSI(s) & "m" @@ -111,10 +115,6 @@ const ANSIColorMap = [ ColorsRGB["white"], ] -var goutfile: File -proc putc(c: char): cint {.cdecl.} = - goutfile.write(c) - proc write(term: Terminal, s: string) = when termcap_found: discard tputs(cstring(s), cint(s.len), putc) |