[accerciser] ipython: Adding auto-indentation



commit edb76c88d3a88534ae241ff62553d1f23b17456b
Author: Javier Hernández <jhernandez emergya com>
Date:   Tue Feb 25 02:17:59 2014 +0100

    ipython: Adding auto-indentation

 plugins/ipython_view.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/plugins/ipython_view.py b/plugins/ipython_view.py
index 7d579f6..418b0a5 100755
--- a/plugins/ipython_view.py
+++ b/plugins/ipython_view.py
@@ -171,9 +171,11 @@ class IterableIPShell:
       if not self.iter_more:
           source_raw = self.IP.input_splitter.raw_reset()
           self.IP.run_cell(source_raw, store_history=True)
+          self.IP.rl_do_indent = False
       else:
           # TODO: Auto-indent
           #
+          self.IP.rl_do_indent = True
           pass
 
     sys.stdout = orig_stdout
@@ -462,6 +464,10 @@ class ConsoleView(gtk.TextView):
     self.text_buffer.move_mark(self.line_start, self.text_buffer.get_end_iter())
     self.text_buffer.place_cursor(self.text_buffer.get_end_iter())
 
+    if self.IP.rl_do_indent:
+      indentation = self.IP.input_splitter.indent_spaces * ' '
+      self.text_buffer.insert_at_cursor(indentation)
+
   def onKeyPress(self, widget, event):
     '''
     Key press callback used for correcting behavior for console-like 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]