about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-03-21 18:35:48 +0100
committerbptato <nincsnevem662@gmail.com>2024-03-21 18:35:48 +0100
commit3d234c50d04ef1d00e199d1cd704ab82765468ac (patch)
treea06b3e2d4e894bbcf1c179590e30314b8bfc7e1e /src
parentfb4e7db781c743d7b83245097c7dc91b87b76eb8 (diff)
downloadchawan-3d234c50d04ef1d00e199d1cd704ab82765468ac.tar.gz
term: use termcap for italic reset
Diffstat (limited to 'src')
-rw-r--r--src/local/term.nim10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/local/term.nim b/src/local/term.nim
index a5ae3567..a7a41e40 100644
--- a/src/local/term.nim
+++ b/src/local/term.nim
@@ -35,8 +35,9 @@ type
     mr # start reverse mode
     mb # start blink mode
     ZH # start italic mode
-    ue # end underline mode
     se # end standout mode
+    ue # end underline mode
+    ZR # end italic mode
     me # end all formatting modes
     vs # enhance cursor
     vi # make cursor invisible
@@ -229,8 +230,11 @@ proc startFormat(term: Terminal, flag: FormatFlags): string =
 
 proc endFormat(term: Terminal, flag: FormatFlags): string =
   when termcap_found:
-    if flag == ffUnderline and term.isatty():
-      return term.cap ue
+    if term.isatty():
+      case flag
+      of ffUnderline: return term.cap ue
+      of ffItalic: return term.cap ZR
+      else: discard
   return SGR(FormatCodes[flag].e)
 
 proc setCursor*(term: Terminal, x, y: int) =