Permalink
Browse files

defensive on prompt detection

  • Loading branch information...
1 parent 773e416 commit e4439ac6b6e376a22d2bba13bfd36c8ae8f7022c @JPMoresmau committed Oct 30, 2012
@@ -406,7 +406,12 @@ public synchronized void streamAppended( final String text, final IStreamMonitor
synchronized( response ) {
atEnd=false;
response.append(text);
- atEnd=text.endsWith( GHCiSyntax.PROMPT_END);
+ /**
+ * what do we do here? We got users complaining that sometimes we didn't realize GHCi was at the prompt
+ * the only explanation I could find is that the PROMPT_END string we look for got actually cut in two
+ * and so the text parameter never contained it. So if text is smaller than PROMPT_END, we check the whole response
+ */
+ atEnd=text.length()>=GHCiSyntax.PROMPT_END.length()?text.endsWith( GHCiSyntax.PROMPT_END):response.toString().endsWith( GHCiSyntax.PROMPT_END);
if (atEnd){
if (thread.isSuspended()){
Matcher m2=GHCiSyntax.CONTEXT_PATTERN.matcher( response.toString() );

0 comments on commit e4439ac

Please sign in to comment.