samsonl / enchanter

Automatically exported from code.google.com/p/enchanter
0 stars 0 forks source link

Very Good Project ! I found a little problem to check #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I found a little problem in the logic of the  "prompt" matching process
if we matching "\r\n" and input "\r\r\n" then the origin logic can't match,
so I changed to the following :

Prompt prompt = (Prompt) waitFor.get(m);
            boolean curCharMatch=prompt.matchChar(s);
            if(!curCharMatch)
            {
                //prev matched already
                if(prompt.pos!=0)
                {
                    prompt.resetPos();
                    curCharMatch=prompt.matchChar(s);

                }
            }
            if (curCharMatch) {
                // the whole thing matched so, return the match answer
                if (prompt.match()) {
                    return m;
                } else {
                    prompt.nextPos();
                }

            } else {

                // if the current character did not match reset
                prompt.resetPos();
                if (s == '\n' || s == '\r') {
                    lastLine.setLength(0);
                }
            }

It works !!
I hope you will continue this project ,I think it's the best "expect liked 
tools in Java

Original issue reported on code.google.com by springco...@hotmail.com on 29 Oct 2009 at 4:52

GoogleCodeExporter commented 9 years ago
How to use it in Java Code?

Original comment by sumit.na...@gmail.com on 9 Jan 2014 at 2:49