linuxmint/xed

In RTL languages, moving by arrows from line to line jumps randomly

Opened this issue · 4 comments

 * Xed version (xed --version)
 * Distribution - (Mint 17.2, Arch, Fedora 25, etc...)

xed - Version 3.2.8
Linux Mint 21.1

Issue

When you have an RTL text over more than one line, if you hit the right arrow key (while in the second line), you should be able to go back character by character until you reach the beginning of the current line, then the end of the previous line.

What happens is that the cursor just jumps to a random position in the previous line. Sometimes it refuses to move, but I cannot figure out how to reproduce this freeze of movement.

The issue occur with any font, so it's not a font issue.

Steps to reproduce

  1. Write some Arabic text in a new file.
  2. Resize the window so that the text is divided into multiple lines.
  3. Put the cursor after the first word of the last line (for example). Start moving backwards by hitting the right arrow key. You will notice the wrong jump.

A sample text from Wikipedia:

تنتمي اللغة العربية إلى أسرة اللغات السامية المتفرعة من مجموعة اللغات الإفريقية الآسيوية. وتضم مجموعة اللغات السامية لغات حضارة الهلال الخصيب القديمة، مثل الأكادية والكنعانية والآرامية واللغة الصيهدية (جنوب الجزيرة العربية) واللغات العربية الشمالية القديمة وبعض لغات القرن الإفريقي كالأمهرية. وعلى وجه التحديد، يضع اللغويون اللغة العربية في المجموعة السامية الوسطى من اللغات السامية الغربية.

The same issue happens with other RTL languages, like Hebrew.

Expected behaviour

The cursor should move backwards smoothly, going from the first character in the current line to the last character in the previous line, just like in English and other LTR languages.

Other information

This is a new issue. I just updated to LinuxMint 21.1 yesterday. I use xed daily and I never noticed such a behaviour before. So, it's likely that it was introduced in a newer version than the one in LinuxMint 20.

Strangely enough, moving using ctrl+arrow works properly without random jumps.

I have downgraded xed (and xed-common) to the version used in Linux Mint 20.3, which is 3.2.2.
However, the issue is still there. It seems that whatever causes the bug is not in xed itself.

I also tried the same behavior in pluma, and it turns out that the same issue occurs there as well.

The issue mostly certainly is in libpango-1.0-0. Here are the exact steps to reproduce the wrong behavior in xed version 3.2.2.

  1. Install a fresh copy of Linux Mint (any flavor, I chose MATE).
  2. Run xed --version. It shows xed - Version 3.2.2. Also, apt show libpango-1.0-0 should show this version 1.44.7-2ubuntu4.
  3. Open xed and make sure that the behavior is correct (check my first comment in this issue). It works properly and the cursor does NOT jump to wrong positions in the previous line.
  4. Now, add jammy repositories manually to this file: /etc/apt/sources.list.d/official-package-repositories.list. Basically, duplicate all lines that have focal in them, and replace focal with jammy.
  5. Run sudo apt update.
  6. Now, update libpango-1.0-0 by: sudo apt install libpango-1.0-0. It will be updated with its dependencies.
  7. Make sure that xed is still 3.2.2 by running: xed --version. It still IS 3.2.2.
  8. Run apt show libpango-1.0.-0. It shows 1.50.6+ds-2ubuntu1.
  9. Open xed and follow the steps from my first comment. The wrong behavior is now here. The cursor WILL jump abruptly when moving by keyboard arrows from one line to the previous one (only with RTL languages).

Now, how to proceed from this point? The issue clearly lies in pango library and/or one or more of its dependencies.

Should this issue be closed then?