markor icon indicating copy to clipboard operation
markor copied to clipboard

Strange behavior when editing large files

Open jourje opened this issue 10 months ago • 10 comments

⚠️ This issue respects the following points: ⚠️

  • [X] This is a bug. Not a question or feature request.
  • [X] The topic is not already reported at Issues. (I've searched it).
  • [X] Markor is up to date. See Releases for the latest version. Updates are available from F-Droid and GitHub.
  • [X] The bug is still present in the latest development version (git master). (Please download and try the test version of Markor, named Marder. Don't worry; Markor and Marder appear as completely separate applications. You can install both side-by-side, and Markor settings are not touched. In case the issue is resolved there, you don't need to create a bug report. The change will be part of the next Markor update.)

Description

When editing some files (it seems to happen only on large files, 200+ lines), the first input after changing the focused line cause a strange behavior. The newly focused line is modified with part of the old focused line (see screenshot), and I have to undo a few times to get the right text back. This only happens once when opening the file. On those files it happens every time. It doesn't happen on every file.

I run the latest FDroid version. But this has been the case for as long as I've been using the app (a year or 2).

Opening the file: Screenshot_20250109-130126

Changing focus and hitting new line: Screenshot_20250109-130137

Steps to reproduce

  1. Open a large file
  2. Choose a different line
  3. Input something

Information

Android version: 15 Device: Pixel 8 App Version: v2.14.0 (157)

Source

F-Droid

Format / File type

Not specific

Additional info / Log

-

jourje avatar Jan 09 '25 12:01 jourje

One of the files: mtg.txt

jourje avatar Jan 09 '25 12:01 jourje

I can't reproduce this at all.

Are you using a 3rd party keyboard?

harshad1 avatar Jan 10 '25 19:01 harshad1

No, I am using the default AOSP keyboard shipped with grapheneOS.

But you are right, it may very well be a system issue and not an app issue. Especially since I seem to be the only one experiencing it.

I will try with another editor and report here if it behaves the same.

jourje avatar Jan 10 '25 20:01 jourje

I seem to be the only one experiencing it.

I recall getting a similar issue with Markor and Gboard, and switched to Obsidian on Android over it. Then I started getting truncated files or failing to save changes, and nobody seems to have reported that either, so I'm planning to test Markor again. I haven't gotten this issue yet, but will keep this thread updated.

nyanpasu64 avatar Jan 22 '25 19:01 nyanpasu64

Sorry, the specific different issue I got was the keyboard freezing up when I slid the backspace key left to delete by words.

nyanpasu64 avatar Jan 24 '25 11:01 nyanpasu64

I am relieved that someone else also faces this issue 😟 I have been trying to find reliable steps to reproduce on my device for quite some time, but haven't succeeded yet. It has been annoying me for months and is imho rather severe in the sense that it screws up the file (yes, Undo luckily works).

Device and OS

  • Android version: 15, CalyxOS
  • Device: Pixel 7a
  • App Version: v2.14.0
  • AOSP keyboard

Rather similar to the one from @jourje I'd say.

Issue description My take on describing the issue: When opening a file that I had opened in Markor before, the cursor is at the position where I previously left. When then tapping into a different line, the cursor visibly changes to that position. When now starting to type (via AOSP on-screen keyboard), the typed character is written to the old position instead. And additionally, left to this typed character, the contents from the tapped on line replace the corresponding amount of characters here. It hence screws up the text around the old cursor position.

Further findings

  • This happened for me within Markdown files (I mainly use this type), but also within todo.txt.
  • It indeed seems to be related to a larger file size.
  • It generally happens when freshly reopening a file, but once I noticed it also during the editing of a file, after hitting Enter a lot of times to move a text block "out of sight"; where the subsequent tap into another line and then typing also caused described behavior.
  • For me this seems to have started with v2.13.x, but not 100% sure on this bit.

Reasons why I think that it is not related to the AOSP keyboard:

  • It only happens in Markor, not any other messenger or the like.
  • It generally only happens after opening a file in Markor, that seems like a keyboard-independent context.
  • The keyboard should not have control over the cursor position, i.e. cannot jump back nor knows that position?

c-s-n avatar Jan 25 '25 10:01 c-s-n

The keyboard should not have control over the cursor position, i.e. cannot jump back nor knows that position?

The AOSP keyboard shipped with CalyxOS comes with a gesture that moves the cursor by sliding your finger over the Space bar, so it does have some control over it.

I can only reproduce this problem with Markor — tested CalyxOS and LineageOS. But I don't know... maybe it's because Markor is the only text editor I use on my phone.


EDIT: I have been testing a very different keyboard named thumb-key, and so far I could not reproduce the bug with it.

o-alquimista avatar Jan 31 '25 16:01 o-alquimista

I experience the same issue on GrapheneOS with the stock keyboard.

achrodo avatar Mar 05 '25 18:03 achrodo

When sliding the backspace key to the left on GBoard, I get error:

2025-04-03 23:08:59.278 14508-14508 JavaBinder              net.gsantner.markor_test             E  !!! FAILED BINDER TRANSACTION !!!  (parcel size = 1051084)
2025-04-03 23:08:59.278 14508-14508 AndroidFuture           net.gsantner.markor_test             E  Failed to propagate completion
                                                                                                    android.os.TransactionTooLargeException: data parcel size 1051084 bytes
                                                                                                    	at android.os.BinderProxy.transactNative(Native Method)
                                                                                                    	at android.os.BinderProxy.transact(BinderProxy.java:586)
                                                                                                    	at com.android.internal.infra.IAndroidFuture$Stub$Proxy.complete(IAndroidFuture.java:115)
                                                                                                    	at com.android.internal.infra.AndroidFuture.onCompleted(AndroidFuture.java:188)
                                                                                                    	at com.android.internal.infra.AndroidFuture.complete(AndroidFuture.java:137)
                                                                                                    	at android.view.inputmethod.RemoteInputConnectionImpl.lambda$dispatchWithTracing$49(RemoteInputConnectionImpl.java:1452)
                                                                                                    	at android.view.inputmethod.RemoteInputConnectionImpl.$r8$lambda$2C56kBNyimaX29P3MVRhxNO0E2M(Unknown Source:0)
                                                                                                    	at android.view.inputmethod.RemoteInputConnectionImpl$$ExternalSyntheticLambda35.run(D8$$SyntheticClass:0)
                                                                                                    	at android.os.Handler.handleCallback(Handler.java:991)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:232)
                                                                                                    	at android.os.Looper.loop(Looper.java:317)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8787)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:871)

The parcel size is just above the size of the file being edited in bytes.

If I move the cursor between the top and bottom of the document I see:

2025-04-03 23:11:27.886 14508-14508 JavaBinder              net.gsantner.markor_test             E  !!! FAILED BINDER TRANSACTION !!!  (parcel size = 2095472)
2025-04-03 23:11:27.887 14508-14508 AndroidFuture           net.gsantner.markor_test             E  Failed to propagate completion
                                                                                                    android.os.TransactionTooLargeException: data parcel size 2095472 bytes
                                                                                                    	at android.os.BinderProxy.transactNative(Native Method)
                                                                                                    	at android.os.BinderProxy.transact(BinderProxy.java:586)
                                                                                                    	at com.android.internal.infra.IAndroidFuture$Stub$Proxy.complete(IAndroidFuture.java:115)
                                                                                                    	at com.android.internal.infra.AndroidFuture.onCompleted(AndroidFuture.java:188)
                                                                                                    	at com.android.internal.infra.AndroidFuture.complete(AndroidFuture.java:137)
                                                                                                    	at android.view.inputmethod.RemoteInputConnectionImpl.lambda$dispatchWithTracing$49(RemoteInputConnectionImpl.java:1452)
                                                                                                    	at android.view.inputmethod.RemoteInputConnectionImpl.$r8$lambda$2C56kBNyimaX29P3MVRhxNO0E2M(Unknown Source:0)
                                                                                                    	at android.view.inputmethod.RemoteInputConnectionImpl$$ExternalSyntheticLambda35.run(D8$$SyntheticClass:0)
                                                                                                    	at android.os.Handler.handleCallback(Handler.java:991)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:232)
                                                                                                    	at android.os.Looper.loop(Looper.java:317)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8787)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:871)

This is about twice the size of the document being edited.

I wonder if Markor places the whole file in a single EditText or such widget, and Android is not built for this use case (loads the entire file into memory and takes time to process the file proportional to file size)?

nyanpasu64 avatar Apr 04 '25 06:04 nyanpasu64

Found this in the GrapheneOS issue tracker:

It's a Jetpack Compose bug. It being incompatible with AOSP keyboard (Android's reference keyboard) is their issue to fix.

GrapheneOS/os-issue-tracker#2353

x51mon avatar Jun 15 '25 09:06 x51mon

Thanks @x51mon for this nice find.

Indeed, it all points to it being the AOSP keyboard, resp. the combination of it with some Android edit components. And I found it to also happen when tapping on a (misspelled) word and then tapping the AOSP keyboard's word suggestion. Note that it actually is independent of the file size, see also above linked issue.

Forgive my Android development ignorance, but wouldn't a bug in Jetpack Compose mean Markor had to make use of androidx.compose.* to be affected? Seems it doesn't. If it also affects android.widget.TextView, doesn't this rather point to a keyboard bug?

But in conclusion, this likely cannot and should not be fixed by the Markor devs; and I actually feel sorry about such issues, considering e.g. this comment:

I feel like I spend 50% of my Markor development / hobby time fighting with Android's TextView / EditText. So many bad decisions in it's design...

c-s-n avatar Jul 14 '25 10:07 c-s-n

I'm testing a bunch of popular keyboards from F-Droid — including Heliboard (which is based on the AOSP keyboard) — and so far I could not reproduce this on any of them.

Keyboards tested:

  • Thumb key
  • Heliboard
  • Unexpected Keyboard
  • AnySoftKeyboard

o-alquimista avatar Aug 10 '25 14:08 o-alquimista