slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.24k stars 581 forks source link

Text selection for LineEdit element on Android is misplaced (when TextEdit is moved when the anchors are displayed) #6531

Open beac0n opened 3 days ago

beac0n commented 3 days ago

OS: Android 14, Pixel 8, Google Source: https://github.com/beac0n/slint-debug

x doctor output:

> $ x doctor                                                                                                                                                                                                                   [±main ●]
--------------------clang/llvm toolchain--------------------
clang                18.1.8              /sbin/clang
clang++              18.1.8              /sbin/clang++
llvm-ar              unknown             /sbin/llvm-ar
llvm-lib             unknown             /sbin/llvm-lib
llvm-readobj         18.1.8              /sbin/llvm-readobj
lld                  18.0.1              /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/lld
lld-link             18.0.1              /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/lld-link
lldb                 unknown             /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/lldb
lldb-server          not found

----------------------------rust----------------------------
rustup               1.27.1              /sbin/rustup
cargo                1.81.0              /sbin/cargo

--------------------------android---------------------------
adb                  1.0.41              /sbin/adb
javac                17.0.12             /sbin/javac
java                 17.0.12             /sbin/java
kotlin               not found
gradle               8.10.2              /sbin/gradle

----------------------------ios-----------------------------
idevice_id           1.3.0-dirty         /sbin/idevice_id
ideviceinfo          1.3.0-dirty         /sbin/ideviceinfo
ideviceinstaller     not found
ideviceimagemounter  1.3.0-dirty         /sbin/ideviceimagemounter
idevicedebug         1.3.0-dirty         /sbin/idevicedebug
idevicedebugserverproxy 1.3.0-dirty         /sbin/idevicedebugserverproxy

---------------------------linux----------------------------
mksquashfs           not found

sdkmanager --list_installed output

Installed packages:
  Path                 | Version       | Description                             | Location            
  -------              | -------       | -------                                 | -------             
  build-tools;34.0.0   | 34.0.0        | Android SDK Build-Tools 34              | build-tools/34.0.0  
  cmdline-tools;latest | 16.0          | Android SDK Command-line Tools (latest) | cmdline-tools/latest
  ndk-bundle           | 27.0.12077973 | Android NDK                             | ndk-bundle          
  platform-tools       | 35.0.2        | Android SDK Platform-Tools              | platform-tools      
  platforms;android-34 | 3             | Android SDK Platform 34                 | platforms/android-34
  tools                | 26.1.1        | Android SDK Tools 26.1.1                | tools 

Expected behavior: When selecting text in a LineEdit element, the selection marks should be at the correct positions What actually happens: The selection marks are way too high (see screenshot).

Selection markers too high: Screenshot_20241013-185433

Cursor jumps when keyboard pops up: Screenshot_20241013-190432

How to reproduce:

ogoffart commented 2 days ago

Thanks for the bug report. I can reproduce. It seems that the position of the anchors do not update when the TextEdit moves. And the TextEdit moves in this case because the on-screen keyboard is shown or hidden. (and that resizes the window which changes the layout)