[Pydev-cvs] org.python.pydev/src/org/python/pydev/editor/actions PyFormatStd.java, 1.20, 1.21
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2008-08-17 00:26:38
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6943/src/org/python/pydev/editor/actions Modified Files: PyFormatStd.java Log Message: <li><strong>Pydev debugger</strong>Workaround for python bug when filenames don't have absolute paths correctly generated</li> <li><strong>Pydev code-completion</strong>Wild import will only show tokens defined in __all__ (if it's available)</li> <li><strong>Interactive console</strong>: Fixed problem when more attempts to connect were needed</li> <li><strong>Interactive console</strong>Fixed console integration problem with other plugins because of interfaces not properly implemented</li> <li><strong>Code Formatter</strong>: Exponentials handled correctly</li> <li><strong>Launching</strong>: Unit-test and code-coverage may launch multiple folders/files at once</li> <li><strong>Code coverage</strong>: Number format exception no longer given when trying to show lines not executed in the editor and all lines are executed</li> Index: PyFormatStd.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/PyFormatStd.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** PyFormatStd.java 19 Jul 2008 19:53:31 -0000 1.20 --- PyFormatStd.java 17 Aug 2008 00:26:46 -0000 1.21 *************** *** 231,234 **** --- 231,267 ---- case '+': case '-': + + if(c == '-' || c == '+'){ // could also be * + + //handle exponentials correctly: e.g.: 1e-6 cannot have a space + FastStringBuffer localBufToCheckNumber = new FastStringBuffer(); + for(int j=buf.length()-1;j>=0;j--){ + char localC = buf.charAt(j); + if(Character.isJavaIdentifierPart(localC)){ + localBufToCheckNumber.append(localC); + }else{ + break; + } + } + boolean isExponential = true;; + String partialNumber = localBufToCheckNumber.reverse().toString(); + int partialLen = partialNumber.length(); + if(partialLen < 2 || !Character.isDigit(partialNumber.charAt(0))){ + //at least 2 chars: the number and the 'e' + isExponential = false; + }else{ + //first char checked... now, if the last is an 'e', we must leave it together no matter what + if(partialNumber.charAt(partialLen-1) != 'e'){ + isExponential = false; + break; + } + } + if(isExponential){ + buf.append(c); + break; + } + //Otherwise, FALLTHROUGH + } + case '/': case '%': |