< prev index next >

src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java

Print this page

        

@@ -3497,14 +3497,10 @@
             }
         }
 
         int pstart = (int) diag.getStartPosition();
         int pend = (int) diag.getEndPosition();
-        if (pstart < 0 || pend < 0) {
-            pstart = 0;
-            pend = source.length();
-        }
         Matcher m = LINEBREAK.matcher(source);
         int pstartl = 0;
         int pendl = -2;
         while (m.find(pstartl)) {
             pendl = m.start();

@@ -3512,11 +3508,11 @@
                 break;
             } else {
                 pstartl = m.end();
             }
         }
-        if (pendl < pstartl) {
+        if (pendl < pstart) {
             pendl = source.length();
         }
         toDisplay.add(source.substring(pstartl, pendl));
 
         StringBuilder sb = new StringBuilder();
< prev index next >