about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
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) =