From: <k_s...@us...> - 2010-02-27 13:10:29
|
Revision: 17393 http://jedit.svn.sourceforge.net/jedit/?rev=17393&view=rev Author: k_satoda Date: 2010-02-27 12:13:39 +0000 (Sat, 27 Feb 2010) Log Message: ----------- Changed the initial value of VFSBrowser#currentEncoding to null so that it doesn't overwrite more accurate encoding information like buffer histories, until the user explicitly specify it. (SF.net bug #1524181, #1721796) Modified Paths: -------------- jEdit/trunk/doc/CHANGES.txt jEdit/trunk/org/gjt/sp/jedit/browser/BrowserCommandsMenu.java jEdit/trunk/org/gjt/sp/jedit/browser/VFSBrowser.java jEdit/trunk/org/gjt/sp/jedit/browser/VFSFileChooserDialog.java Modified: jEdit/trunk/doc/CHANGES.txt =================================================================== --- jEdit/trunk/doc/CHANGES.txt 2010-02-27 11:56:57 UTC (rev 17392) +++ jEdit/trunk/doc/CHANGES.txt 2010-02-27 12:13:39 UTC (rev 17393) @@ -37,6 +37,9 @@ - Using regex style encoding auto detectors, StringIndexOutOfBoundsException could happen when loading a file. (Kazutoshi Satoda) +- The encoding could be less accurate when opening a file from + File System Browser. (Kazutoshi Satoda) + }}} {{{ API changes Modified: jEdit/trunk/org/gjt/sp/jedit/browser/BrowserCommandsMenu.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/browser/BrowserCommandsMenu.java 2010-02-27 11:56:57 UTC (rev 17392) +++ jEdit/trunk/org/gjt/sp/jedit/browser/BrowserCommandsMenu.java 2010-02-27 12:13:39 UTC (rev 17393) @@ -166,7 +166,7 @@ //{{{ update() method public void update() { - if(encodingMenuItems != null) + if(encodingMenuItems != null && browser.currentEncoding != null) { JRadioButtonMenuItem mi = encodingMenuItems.get( browser.currentEncoding); Modified: jEdit/trunk/org/gjt/sp/jedit/browser/VFSBrowser.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/browser/VFSBrowser.java 2010-02-27 11:56:57 UTC (rev 17392) +++ jEdit/trunk/org/gjt/sp/jedit/browser/VFSBrowser.java 2010-02-27 12:13:39 UTC (rev 17393) @@ -176,8 +176,7 @@ KeyListener keyListener = dwm.closeListener(NAME); addKeyListener(keyListener); - currentEncoding = jEdit.getProperty("buffer.encoding", - System.getProperty("file.encoding")); + currentEncoding = null; autoDetectEncoding = jEdit.getBooleanProperty( "buffer.encodingAutodetect"); @@ -1133,7 +1132,10 @@ if(_buffer == null) { Hashtable<String, Object> props = new Hashtable<String, Object>(); - props.put(JEditBuffer.ENCODING,currentEncoding); + if(currentEncoding != null) + { + props.put(JEditBuffer.ENCODING,currentEncoding); + } props.put(Buffer.ENCODING_AUTODETECT, autoDetectEncoding); _buffer = jEdit.openFile(view, null, @@ -1216,7 +1218,12 @@ } //}}} //{{{ Package-private members + + // This can be null untill an user explicitly selects an encoding + // so that this don't overwrite more accurate encoding information + // like buffer histories. String currentEncoding; + boolean autoDetectEncoding; //{{{ directoryLoaded() method Modified: jEdit/trunk/org/gjt/sp/jedit/browser/VFSFileChooserDialog.java =================================================================== --- jEdit/trunk/org/gjt/sp/jedit/browser/VFSFileChooserDialog.java 2010-02-27 11:56:57 UTC (rev 17392) +++ jEdit/trunk/org/gjt/sp/jedit/browser/VFSFileChooserDialog.java 2010-02-27 12:13:39 UTC (rev 17393) @@ -196,7 +196,10 @@ if(browser.getMode() == VFSBrowser.BROWSER_DIALOG) { Hashtable props = new Hashtable(); - props.put(JEditBuffer.ENCODING,browser.currentEncoding); + if(browser.currentEncoding != null) + { + props.put(JEditBuffer.ENCODING,browser.currentEncoding); + } jEdit.openFile(browser.getView(), browser.getDirectory(), path,false,props); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |