about summary refs log tree commit diff stats
path: root/src/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/io')
-rw-r--r--src/io/buffer.nim9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/io/buffer.nim b/src/io/buffer.nim
index f3fbbd38..a33c88ff 100644
--- a/src/io/buffer.nim
+++ b/src/io/buffer.nim
@@ -73,6 +73,8 @@ type
     displaycontrols*: bool
     redraw*: bool
     location*: Uri
+    source*: string #TODO
+    showsource*: bool
 
 func newBuffer*(attrs: TermAttributes): Buffer =
   new(result)
@@ -783,6 +785,13 @@ proc inputLoop(attrs: TermAttributes, buffer: Buffer): bool =
       reshape = true
       redraw = true
     of ACTION_REDRAW: redraw = true
+    of ACTION_TOGGLE_SOURCE:
+      buffer.showsource = not buffer.showsource
+      if buffer.showsource:
+        buffer.renderPlainText(buffer.source)
+      else:
+        buffer.renderDocument()
+      redraw = true
     else: discard
     stdout.hideCursor()