Closed
Bug 40463
Opened 25 years ago
Closed 25 years ago
Cannot type anything in Composer at selecting Auto-Detect menus
Categories
(Core :: Internationalization, defect, P3)
Core
Internationalization
Tracking
()
VERIFIED
FIXED
People
(Reporter: teruko, Assigned: shanjian)
Details
(Keywords: crash, Whiteboard: [nsbeta2+])
When you select Auto-Detect menu in composer, you will not be able to type
anything in composer.
Steps of reproduce
1. Open Composer
At default, the "Auto-Detect off" is marked.
2. Select menu View|Character coding->Auto Detect (Japanese)
3. Try to type English or Japanese characters
You will not type anything.
When you select any Auto-Detect menus (Chinese or Korean, or so on),
this happens.
Tested 2000-05-24-08 Win32, Mac, and Linux build.
| Reporter | ||
Comment 1•25 years ago
|
||
I am nominating this for beta2. Once user changes the Auto-Detect menu in
Composer, he or she has to exit the Composer to type again.
Keywords: nsbeta2
Summary: Cannot type anything in Composer at selecting Auto-Detect menus → Cannot type anything in Composer at selecting Auto-Detect menus
Comment 2•25 years ago
|
||
What we shouuld do in this case is to 1) either disable the Auto-Detect
menu, or 2) presnet a dialog which says "You cannot use auto-detction
on a document which contains no data."
For Editor, auto-detction can be used only on a document which
contains pre-existing/saved data.
But this bug points out another real problem. That is
if you have an unlabeled document, e.g. Shift_JIS HTML file
which contains data, and if you try to engage auto-detection
on it, it crashes.
Either we should file a new bug on it or deal with it in this
bug. The crash problem must be fxied in this case.
Putting on [nsbeta2+] radar for beta2 fix.
Keywords: crash
Whiteboard: [nsbeta2+]
Comment 5•25 years ago
|
||
auto detection related problem. reassign to shanjian. Shanjian, please
investigate what happen here. cc nhotta
Assignee: ftang → shanjian
Status: ASSIGNED → NEW
| Assignee | ||
Updated•25 years ago
|
Status: NEW → ASSIGNED
| Assignee | ||
Comment 6•25 years ago
|
||
problem:
ResetEditingState() is only called in nsEditorShell::LoadUrl. When
a new charset detector is selected, document will be reloaded.
So inside nsEditorShell::PrepareDocumentForEditing, if mEdit exists,
it should be reinitialized by ResetEditingState().
Add mjudge to cc list.
Michael, could you review my fix? thanks.
Index: nsEditorShell.cpp
===================================================================
RCS file: /cvsroot/mozilla/editor/base/nsEditorShell.cpp,v
retrieving revision 1.170
diff -c -r1.170 nsEditorShell.cpp
*** nsEditorShell.cpp 2000/06/05 20:26:39 1.170
--- nsEditorShell.cpp 2000/06/13 19:07:30
***************
*** 444,450 ****
if (!mContentAreaDocShell || !mContentWindow)
return NS_ERROR_NOT_INITIALIZED;
! NS_ASSERTION(!mEditor, "Should never have an editor here");
// get the webshell for this loader. Need this, not mContentAreaDocShell, in
// case we are editing a frameset
--- 444,451 ----
if (!mContentAreaDocShell || !mContentWindow)
return NS_ERROR_NOT_INITIALIZED;
! if (mEditor)
! ResetEditingState();
// get the webshell for this loader. Need this, not mContentAreaDocShell, in
// case we are editing a frameset
Comment 7•25 years ago
|
||
I don't think that patch is correct. A JavaScript change can fix this bug.
The problem is that when you choose one of the Auto-detect items,
ComposerMultiplexHandler() calls SelectDetector(), which causes a reload by doing
window.content.location.reload(). If a version of this function was written that
calls editorShell.LoadUrl(editorShell.editorDocument.location); then the existing
C++ code would work.
Basically, URL loads in the editor window should go via editorShell.LoadUrl().
Comment 8•25 years ago
|
||
I should justify my last comment. Calling editorShelll.loadUrl is different from
the C++ change above because it causes ResetEditingState() to be called *before*
the url load, not *after* as the patch does. And ResetEditingState() should
really be called before the url load, so that there is no editor around while the
doc is reloading.
| Assignee | ||
Comment 9•25 years ago
|
||
new fix:
Index: charsetOverlay.js
===================================================================
RCS file: /cvsroot/mozilla/xpfe/global/resources/content/charsetOverlay.js,v
retrieving revision 1.12
diff -c -r1.12 charsetOverlay.js
*** charsetOverlay.js 2000/06/02 23:31:52 1.12
--- charsetOverlay.js 2000/06/16 16:14:57
***************
*** 46,52 ****
var charset;
if (name == 'detectorGroup') {
! SelectDetector(event, true);
} else if (name == 'charsetGroup') {
charset = node.getAttribute('id');
charset = charset.substring('charset.'.length, charset.length)
--- 46,52 ----
var charset;
if (name == 'detectorGroup') {
! ComposerSelectDetector(event);
} else if (name == 'charsetGroup') {
charset = node.getAttribute('id');
charset = charset.substring('charset.'.length, charset.length)
***************
*** 83,88 ****
--- 83,110 ----
if (pref) {
pref.SetCharPref("intl.charset.detector", prefvalue);
if (doReload) window.content.location.reload();
+ }
+ }
+
+ function ComposerSelectDetector(event)
+ {
+ dump("Charset Detector menu item pressed: " + event.target.getAttribute(
'id') + "\n");
+
+ var uri = event.target.getAttribute("id");
+ var prefvalue = uri.substring('chardet.'.length, uri.length);
+ if("off" == prefvalue) { // "off" is special value to turn off the detecto
rs
+ prefvalue = "";
+ }
+
+ var pref = Components.classes['component://netscape/preferences'];
+ if (pref) {
+ pref = pref.getService();
+ pref = pref.QueryInterface(Components.interfaces.nsIPref);
+ }
+
+ if (pref) {
+ pref.SetCharPref("intl.charset.detector", prefvalue);
+ editorShell.LoadUrl(editorShell.editorDocument.location);
}
}
Comment 10•25 years ago
|
||
That fix looks good (but please comment out the dump() before checking in).
| Assignee | ||
Updated•25 years ago
|
Whiteboard: [nsbeta2+] → [nsbeta2+], wait for tree open, ready to check in.
| Assignee | ||
Comment 11•25 years ago
|
||
fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Whiteboard: [nsbeta2+], wait for tree open, ready to check in. → [nsbeta2+]
You need to log in
before you can comment on or make changes to this bug.
Description
•