Skip to content

Implement support for big files and Markdown preview#4576

Open
TranceLove wants to merge 2 commits intoTeamAmaze:release/4.0from
TranceLove:feature/text-editor-big-file-markdown
Open

Implement support for big files and Markdown preview#4576
TranceLove wants to merge 2 commits intoTeamAmaze:release/4.0from
TranceLove:feature/text-editor-big-file-markdown

Conversation

@TranceLove
Copy link
Collaborator

@TranceLove TranceLove commented Feb 26, 2026

Description

Implement support for big files and Markdown preview.

With this PR, sliding window is used for buffering big files to prevent OutOfMemory error.

out.mp4

The sliding window currently is set to 102400 characters.

Additionally, using https://github.com/commonmark/commonmark-java support for Markdown preview is also added.

Screenshot_20260226-223920_Amaze Debug Screenshot_20260226-223930_Amaze Debug

Note however, due to the way Commonmark works that it doesn't support dynamically updating output HTML from InputStream, when switching to Markdown preview, it will only render what's inside the sliding window above, if file content is bigger than the sliding window.

Issue tracker

Automatic tests

  • Added test cases

Manual tests

  • Done

Device: Fairphone 5
OS: LineageOS 23.2 (Android 16)

Build tasks success

Successfully running following tasks on local:

  • ./gradlew assembledebug
  • ./gradlew spotlessCheck

@EmmanuelMess
Copy link
Member

EmmanuelMess commented Feb 26, 2026

Probably should add the images as part of the repo or use images with some assurance they won't break in the near future (wikimedia?).

Second video in the description might be broken.

@TranceLove TranceLove force-pushed the feature/text-editor-big-file-markdown branch 2 times, most recently from 7dde1d9 to 6d8b5ef Compare February 26, 2026 14:46
Uses Commonmark for Markdown parsing and rendering.

Due to the way Commonmark works, it cannot support content streaming and update in realtime; user needs to let TextEditorActivity to load as much content as wish.
@TranceLove TranceLove force-pushed the feature/text-editor-big-file-markdown branch from 6d8b5ef to 41f0f13 Compare February 26, 2026 15:33
@VishnuSanal VishnuSanal self-requested a review February 26, 2026 16:45
@EmmanuelMess
Copy link
Member

Should fix #1275.

@TranceLove
Copy link
Collaborator Author

Sidenote: when TextEditorActivity sees the file is big or in Markdown preview mode, it will be in readonly mode and you cannot save the file.

Another story... need to think of a way to track the changed area in the big file which is not easy to do.

Same goes to Markdown mode. I was just thinking of a way to conveniently read Markdowns on the move...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants