Closed Bug 243931 Opened 20 years ago Closed 20 years ago

GTK2 build on AIX: Caret misplaced when inserting RTL input into LTR text

Categories

(Core :: Layout: Text and Fonts, defect)

All
AIX
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: lkemmel, Assigned: pkwarren)

Details

(Keywords: rtl)

Attachments

(2 files)

User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Build Identifier: 

In mozilla text widgets, caret is misplaced when inserting RTL input into LTR 
text.
The problem is not reproducible on Windows.

Reproducible: Always
Steps to Reproduce:
1. Switch language layer to Hebrew or Arabic.
2. Locate the caret in the Address bar with some LTR text (note that gtk2 
doesn't provide contextual language switching, so the keyboard language remains 
RTL).
3. Start inputting RTL characters.

Actual Results:  
The caret is displayed at the leading edge of a typed character.

Expected Results:  
The caret is displayed at the trailing edge of a typed character.
Simon, it seems I have an explanation to what's going on.

After repositioning, caret level is derived from the level of the content it's 
related to. So in Step 2 above it gets level 0.

After new text is inserted, caret level is reset to BIDI_LEVEL_UNDEFINED - to 
be recalculated later, according to the level of the inserted text. - That's 
was supposed to take place in Step 3.

However, on IME composing (which in our case takes place when RTL text is 
inserted), gtk emits the "commit" signal, as opposed to the "key_press_event" 
signal in the absence of IME composing. Event handlers will finally translate 
the former into |kOpInsertText| Editor operation, and the later - into 
|kOpInsertIMEText|.
The only problem is, that |nsTextEditRules::AfterEdit|, when deciding about 
undefying the level, disregards |kOpInsertIMEText|, and checks only 
for "simple" text insertion.

Once I added the missing condition, the problem was resolved.
I'll submit a patch shortly.
Sorry, it should have been vice versa:

"...the former ["commit] - into |kOpInsertIMEText| Editor operation, and the 
latter ["key_press_event"] - into |kOpInsertText|".
Attached patch Proposed patchSplinter Review
Simon, can you review attachment 148756 [details] [diff] [review]? or help in determining r/sr? Thanks!

Comment on attachment 148756 [details] [diff] [review]
Proposed patch

r=smontagu
Attachment #148756 - Flags: review+
Attachment #148756 - Flags: superreview?
Comment on attachment 148756 [details] [diff] [review]
Proposed patch

Lina, when setting the review request flags you should insert the reviewer's
name in the "Requestee" field.
Attachment #148756 - Flags: superreview? → superreview?(roc)
OS: other → AIX
Attachment #148756 - Flags: superreview?(roc) → superreview+
OK, Simon. And if I don't know reviewer's name - I shouldn't set the review 
request flags at all? I think I've seen "review ?" without a name.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Patch checked in.

(In reply to comment #7)
> OK, Simon. And if I don't know reviewer's name - I shouldn't set the review 
> request flags at all? I think I've seen "review ?" without a name.

I don't think there's any rule against it, but there is much more chance of
getting a prompt review if you request by name.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
The bug is fixed for nsPlaintextEditor, but still occurs in nsHTMLEditor.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Similarly to a plain text editor, consider |action ==
nsEditor::kOpInsertIMEText| also in an HTML editor.
Attachment #150647 - Flags: superreview?(roc)
Attachment #150647 - Flags: review?(smontagu)
Comment on attachment 150647 [details] [diff] [review]
Patch for the HTML editor

Sorry, I should have spotted that when reviewing the first patch. r=smontagu.
Attachment #150647 - Flags: review?(smontagu) → review+
> there is much more chance of getting a prompt review if you request by name.

IN fact there is really no chance of ever getting a review if you don't put in a
name.
Attachment #150647 - Flags: superreview?(roc) → superreview+
> IN fact there is really no chance of ever getting a review if you don't put 
> in a name.

I see, thanks.


Can anyone check in the fix please?
I'll check this in today.
Assignee: mkaply → pkwarren
Status: REOPENED → NEW
Fixed.

Checking in nsHTMLEditRules.cpp;
/cvsroot/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp,v  <-- 
nsHTMLEditRules.cpp
new revision: 1.312; previous revision: 1.311
done
Status: NEW → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → FIXED
Mass-assigning the new rtl keyword to RTL-related (see bug 349193).
Keywords: rtl
Component: Layout: BiDi Hebrew & Arabic → Layout: Text
QA Contact: zach → layout.fonts-and-text
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: