Closed Bug 100170 Opened 23 years ago Closed 22 years ago

Cluster based caret operations unsupported

Categories

(Core :: Internationalization, defect)

Sun
Solaris
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: prabhat.hegde, Assigned: smontagu)

References

(Blocks 1 open bug, )

Details

(Keywords: intl)

Attachments

(1 obsolete file)

IN languages such as Thai, Arabic and Indian languages, a single
display unit may consist of :

A> one or more (combining)characters
B> Presentation Forms/ligatures (One or more characters combining to form 
   a glyph)

In such cases cursor and text edit operations should consider a
"Cell/Cluster" as a display unit and not a 'character'. Currently,
mozilla does not support this feature.

A typical example of all the layout code that will break due to the
assumption of character=cell is :

A> Cursor Movements
B> Mouse Click (PointToContentOffset and ContentOffsetToStringIndex)
C> Selection

The following simple patch based on extensions/ctl should fix the 
problem:

Of course before this piece of code is enabled, we need to able to
build extensions/ctl on all platforms. (Currently have tried it on
Solaris and linux). Please let me know of your opinions on the 
patch while i try to add patches to get extensions/ctl built on
non *nix platforms.


Index: nsTextFrame.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/html/base/src/nsTextFrame.cpp,v
retrieving revision 1.318
diff -u -r1.318 nsTextFrame.cpp
--- nsTextFrame.cpp 2001/08/21 01:47:08 1.318
+++ nsTextFrame.cpp 2001/09/17 21:39:43
@@ -83,6 +83,10 @@
 //ahmed end
 #endif // IBMBIDI

+#ifdef SUNCTL
+#include "nsILE.h"
+#endif
+
 #ifndef PR_ABS
 #define PR_ABS(x) ((x) < 0 ? -(x) : (x))
 #endif

@@ -3894,12 +3929,31 @@
 #endif
         aPos->mContentOffset = 0;
     PRInt32 i;
+
+#ifdef SUNCTL
+    static NS_DEFINE_CID(kLECID, NS_ULE_CID);
+
+    nsCOMPtr<nsILE> mCtlObj;
+    mCtlObj = do_CreateInstance(kLECID, &rv);
+    if (NS_FAILED(rv)) {
+      NS_WARNING("Cell based Cursor Movement Will Not Be Supported\n");
+      mCtlObj = nsnull;
+#endif
         for (i = aPos->mStartOffset -1 - mContentOffset; i >=0;  i--){
       if (ip[i] < ip[aPos->mStartOffset - mContentOffset]){
             aPos->mContentOffset = i + mContentOffset;
             break;
       }
     }
+#ifdef SUNCTL
+    }
+    else {
+      PRInt32 mPreviousOffset;
+      mCtlObj->PrevCluster((const PRUnichar*)paintBuffer.mBuffer,
+               textLength, aPos->mStartOffset, &mPreviousOffset
);
+      aPos->mContentOffset = i = mPreviousOffset;
+    }
+#endif
         if (i <0){
       found = PR_FALSE;
       GetPrevInFlow(&frameUsed);
@@ -3915,12 +3969,34 @@
 #endif
         PRInt32 i;
     aPos->mContentOffset = mContentLength;
+
+#ifdef SUNCTL
+    static NS_DEFINE_CID(kLECID, NS_ULE_CID);
+
+    nsCOMPtr<nsILE> mCtlObj;
+    mCtlObj = do_CreateInstance(kLECID, &rv);
+    if (NS_FAILED(rv)) {
+      NS_WARNING("Cell based Cursor Movement Will Not Be Supported\n");
+      mCtlObj = nsnull;
+#endif
+
     for (i = aPos->mStartOffset +1 - mContentOffset; i <= mContentLength;
i++){
           if (ip[i] > ip[aPos->mStartOffset - mContentOffset]){
             aPos->mContentOffset = i + mContentOffset;
             break;
       }
     }
+
+#ifdef SUNCTL
+    }
+    else {
+      PRInt32 mNextOffset;
+      mCtlObj->NextCluster((const PRUnichar*)paintBuffer.mBuffer,
+               textLength, aPos->mStartOffset, &mNextOffset);
+      aPos->mContentOffset = i = mNextOffset;
+    }
+#endif
+
 /*  if (aStartOffset == 0 && (mState & TEXT_SKIP_LEADING_WS))
     i--; //back up because we just skipped over some white space. why skip
over the char also?
 */

prabhat
Keywords: intl
QA Contact: andreasb → zach
assigning to bstell.
Assignee: yokoyama → bstell
Status: NEW → ASSIGNED
This sounds like "Caret operations" (the blinking line indicating the insertion 
point) not "Cursor operations" (which is an arrow or other graphic which is moved 
around on a screen by a mouse)
Summary: Cluster based cursor operations unsupported → Cluster based caret operations unsupported
caret if one is using the arrow keys
cursor if one is using the mouse/pointer to select/set-insertion-point
Target Milestone: --- → mozilla0.9.7
--> ftang
Assignee: bstell → ftang
Status: ASSIGNED → NEW
smontagu- please take a look at this one.
Assignee: ftang → smontagu
nsILE is not ready for all platform yet. move this to m98
Target Milestone: mozilla0.9.7 → mozilla0.9.8
Marking fixed since the patch has been checked in (bug 84380).
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
as tested with Mozilla 0.9.7 (Build ID: 2001122204)
with libraries from Prabhat's workspace
(/net/disk1.sfbay/space0/users/prabhath/netscape6 - 21 Dec)

seem likes it doesn't fixed yet.

ex.

legend:
 ABC   <-- english characters "ABC"
 <c>   <-- base level character  (e.g. consonant)
 <u>   <-- upper level character (e.g. upper vowel)
 <t>   <-- top level character   (e.g. tonemark)
 _     <-- caret position
 


input key strokes:
 <c><u><t>ABC


display order in vertical & horizontal:

<t>
<u>
<c>ABC

(<t> above <u>, <u> above <c>, A is next to <c>)

----

to move caret in front of <c> to back of A..
as tested in my environment, we need 4 left-arrow strokes.
like this...

(let <cut> represents <c><u><t> in vertical order)


stroke 0:  _<cut>ABC
stroke 1:  <cut>_ABC
stroke 2:  <cut>_ABC
stroke 3:  <cut>_ABC
stroke 4:  <cut>A_BC


the correct solution should be like this

stroke 0:  _<cut>ABC
stroke 1:  <cut>_ABC
stroke 2:  <cut>A_BC


just treat <cut> as one cell, one unit.


----

sorry if i've tested with the wrong build.
(pls inform me, which build i need to use, thx :) )
for test case, try these short words


arthit,

Pl try testing with post 1/10 nightly or 0.9.8 builds. Note: you need to use
enable-ctl while building.
VERIFIED, it has been fixed.
(i cannot mark it as VERIFIED by myself,
coz in my page view it shows only 1 selected option "Leave as RESOLVED FIXED")


Prabhat, pls see Bug 122552
"Caret cannot move all along the text, got stucked at some position".

<left>,<right>,<backspace operations works fine.
expect <delete>.

REOPEN.

please see bug 157546
[CTL-Thai] IM: <delete> key should delete WHOLE Thai "display cell"
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
sorry, i do mean.

<left>,<right>,<backspace> operations works fine.
_EXCEPT_ <delete>.

REOPEN.

please see bug 157546
[CTL-Thai] IM: <delete> key should delete WHOLE Thai "display cell"
Blocks: thai
Target Milestone: mozilla0.9.8 → ---
The exact problem of this bug has been fixed and I've
verified on my build (Solaris Netscape7 as well) with --enable-ctl. 
Should be markas as VERIFIED.
Status: REOPENED → RESOLVED
Closed: 23 years ago22 years ago
Resolution: --- → FIXED
verified.
Status: RESOLVED → VERIFIED
QA Contact: zach → katakai
*** Bug 79287 has been marked as a duplicate of this bug. ***
The enable-ctl doesn't work on Windows build. This is tested for Firefox 1.0
build on Windows XP.
8<------------------------->8
configure: error: Cannot build ctl without gmodule support in glib.
8<------------------------->8

So the feature is lacking on Windows build. This feature is very important for
Thai (as well as other CTL languages) to work correctly in Mozilla applications.
And it should work for all platform. Should this issue be reopened and the
Hardware/OS changed to All/All or should I open another issue?
I file a tracker bug for Windows cluster support :-
bug 283271 - Windows : CTL cluster-based operations unsupported on Windows
and a bug on caret movement
bug 283415 - Windows : Caret must be moved by grapheme cluster boundaries
WIP patch

Basics in place:

* List installed apps, touch to export
* List apps detected in backup/apps on SD card, touch to import

TODO:

* Needs to hook up to the not-yet-landed import/export APIs
* Needs some styling improvements
* Tests
* Error handling
* Confirmation prompts?
Attachment #8413024 - Flags: feedback?(fabrice)
Comment on attachment 8413024 [details] [review]
Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/18704

Wrong bug, sorry!
Attachment #8413024 - Attachment is obsolete: true
Attachment #8413024 - Flags: feedback?(fabrice)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: