Repository: zeppelin
Updated Branches:
  refs/heads/master 4cd61db50 -> a7bb45393


[MINOR] Blocking the minus cursor value.

### What is this PR for?
This PR is for blocking minus cursor value on the paragraph.
If we put the ```ctrl+.``` for auto completion on the interpreter name, the 
cursor value to be minus so it occurs 
```java.lang.StringIndexOutOfBoundsException```.

### What type of PR is it?
Improvement | Refactoring

### Screenshots (if appropriate)
![cursor](https://cloud.githubusercontent.com/assets/3348133/16369544/7a347148-3c73-11e6-8d6c-032af0b7520f.gif)

### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no

Author: astroshim <[email protected]>

Closes #1090 from astroshim/feat/fixCursorValue and squashes the following 
commits:

b993f2b [astroshim] check cursor value.


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/a7bb4539
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/a7bb4539
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/a7bb4539

Branch: refs/heads/master
Commit: a7bb45393232f0e8638942fcf78518acbcc2a8f7
Parents: 4cd61db
Author: astroshim <[email protected]>
Authored: Mon Jun 27 14:05:58 2016 +0900
Committer: Alexander Bezzubov <[email protected]>
Committed: Tue Jun 28 19:06:16 2016 +0900

----------------------------------------------------------------------
 .../src/main/java/org/apache/zeppelin/notebook/Paragraph.java      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a7bb4539/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java
index 4e02fb1..bc53887 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java
@@ -208,7 +208,7 @@ public class Paragraph extends Job implements Serializable, 
Cloneable {
 
   public List<InterpreterCompletion> completion(String buffer, int cursor) {
     String replName = getRequiredReplName(buffer);
-    if (replName != null) {
+    if (replName != null && cursor > replName.length()) {
       cursor -= replName.length() + 1;
     }
     String body = getScriptBody(buffer);

Reply via email to