https://bugs.kde.org/show_bug.cgi?id=451789
Bug ID: 451789 Summary: navigating arrow keys while on RTL keyboard layout stuck on endless loop Product: frameworks-ktexteditor Version: unspecified Platform: unspecified OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: general Assignee: kwrite-bugs-n...@kde.org Reporter: as.afgre.enb...@gmail.com Target Milestone: --- SUMMARY *** when editing RTL text (right-to-left keyboard layout; languages such as hebrew, arabic, urdu), empty raws are still considered LTR. Consequently, arrow keys are contradicting, causing the cursor to get stuck in an infinite loop. *** STEPS TO REPRODUCE 1. add RTL text in line #1 2. add empty line at line n+1 (line #2) 3. add another RTL text at line n+2 (line #3) 4. place the cursor at the end or middle of line #3 (e.g. press HOME key on line #3) 5. press the LEFT arrow repeatedly. example text (copy > paste into Kate, beteen the "-----" lines -- the empty line in the middle is needed): -------- שורה ראשונה מילה נוספת. שורה שלישית מילה אחרונה. --------- OBSERVED RESULT 6. The cursort will arive to end of line #1, and to line #2 7. From line #2 the cursor will go back to line #1. EXPECTED RESULT The cursor was supposed to continue to next lines / text. SOFTWARE/OS VERSIONS Linux/KDE Plasma: all versions. KDE Frameworks Version: ? Qt Version: ? ADDITIONAL INFORMATION Why is that happening: In RTL context, LEFT means "go forward", and "right" means "backwards". In LTR it is the opposite. When pressing LEFT key, the cursor start of the RTL line "forwards" until it arrives to line #2. However, line 2 is empty, thus automatically set to LTR (regardless of previous/next line, or previous RTL settings). in LTR contextx, LEFT key means "go forward", so the cursor moves BACKWARDS to previous line, #1, never reaching line #3. ad infinitum. Same happenes with CTRL+Arrow keys. Same behavior happens in the other direction (End of text to Beginning) Possible solutions: Option 1. Define the RTL / LTR property of an empty line by its preceding line's directionality regex= ^[א-ת].*?\n(<dir=RTL>) Option 2. Retain cursor order when arrow keys are pressed. I.e. when starting a sequence of arrow keystrokes (or ctrl+arrow), keep the same logical direction until a different key is pressed. 3. let user set LTR/RTL direcetionality for the whole passage. (e.g. facebook setting RTL /LTR by the first letter of the document. Example #2: correct behavior (even if illogical) In a single, mixed sentence, the cursor continues its initial direction, in spite of "illogical" contradition inside the English passage. This is a correct behavior [considering the natural limitations of plaintext editors]. Place the cursor at the beginning of the line, and press multiple LEFT arrow keys (or SHIFT+LEFT). The corsor will arrive correctly to the end of the sentence. 1. מילה, ועוד אחת. inline LTR text here, ואז נוספת סוף שורה. 1. Copy the following text to a text editor / text box, 2. place cursor at beginning of the line. 3. press multiple LEFT keys (or SHIFT+LEFT). Example #3: Moving between RTL to LTR lines: שלום לבוא שבת how many lines must a man להמשיך ללכת Expected behavior: When pressing an arrow key (or any arrow+modifier), cursor jumps to each "next" word, until end of text. Actual behavior: When starting in a RTL text, cursor traverses CORRECTLY & logically from left to right, until an empty (or LTR) line. At the empty / LTR line, cursor's direction reveresed and it goes backwards to previous line. -- You are receiving this mail because: You are watching all bug changes.