From 364f40274dca83878a82a873dbf3dc2ec26fbcfa Mon Sep 17 00:00:00 2001
From: Rishi <rishiloyola98245@gmail.com>
Date: Mon, 22 Dec 2014 18:06:32 +0530
Subject: [PATCH] Update SpellView.coffee

hey i made changes. due to some error in downloading your data base i cannot test it. but check it . i think it will work .
---
 app/views/play/level/tome/SpellView.coffee | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/app/views/play/level/tome/SpellView.coffee b/app/views/play/level/tome/SpellView.coffee
index 2527c72a4..dc6613f59 100644
--- a/app/views/play/level/tome/SpellView.coffee
+++ b/app/views/play/level/tome/SpellView.coffee
@@ -215,7 +215,23 @@ module.exports = class SpellView extends CocoView
     addCommand
       name: 'disable-spaces'
       bindKey: 'Space'
-      exec: => @ace.execCommand 'insertstring', ' ' unless LevelOptions[@options.level.get('slug')]?.disableSpaces
+      exec: =>
+        cursor = @ace.getCursorPosition()
+          sentance = @aceDoc.getLine(cursor.row)
+          
+      commentStarts =
+      javascript: '//'
+      python: '#'
+      coffeescript: '#'
+      clojure: ';'
+      lua: '--'
+      io: '//'
+    commentStart = commentStarts[@spell.language] or '//'
+    if(flg=/#{commentStart}/.test sentance)
+    @ace.execCommand 'insertstring', ' '
+    else
+    @ace.execCommand 'insertstring', ' ' unless LevelOptions[@options.level.get('slug')]?.disableSpaces
+    
     addCommand
       name: 'throttle-backspaces'
       bindKey: 'Backspace'