From 7c353d2bd2b1fc728f38573c4c59e5055ce8fb04 Mon Sep 17 00:00:00 2001 From: Mark Needham Date: Wed, 1 May 2013 01:24:18 +0100 Subject: [PATCH] if there is no current selection then use the whole file --- neo4j.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/neo4j.py b/neo4j.py index a50277f..d0e9aff 100644 --- a/neo4j.py +++ b/neo4j.py @@ -21,7 +21,10 @@ def run(self, edit): selections = self.view.sel() #assing text from selection to the query object - CYPHER_QUERY["query"] = self.view.substr(selections[0]) + if self.view.substr(selections[0]): + CYPHER_QUERY["query"] = self.view.substr(selections[0]) + else: + CYPHER_QUERY["query"] = self.view.substr(self.view.visible_region()) #convert into proper json data = json.dumps(CYPHER_QUERY)