Skip to content

Add Compose editor + migrate core architecture to CodeEditorDelegate (breaking) - #839

Draft
itsvks19 wants to merge 23 commits into
Rosemoe:mainfrom
itsvks19:compose
Draft

Add Compose editor + migrate core architecture to CodeEditorDelegate (breaking)#839
itsvks19 wants to merge 23 commits into
Rosemoe:mainfrom
itsvks19:compose

Conversation

@itsvks19

@itsvks19 itsvks19 commented May 1, 2026

Copy link
Copy Markdown
Contributor

This PR adds a new editor-compose module and rewires a big part of the editor so it can run in Compose without depending on the Android View (CodeEditor).

To make that work, the core logic now goes through CodeEditorDelegate instead of the View. The old View-based editor still works, but it’s no longer the center of everything.

Also fixes a bunch of annoying interop issues along the way (gesture conflicts, IME weirdness, some leaks, etc.).

Breaking changes

Events no longer return CodeEditor.

They now return CodeEditorDelegate.

Before:

CodeEditor editor = event.getEditor();

After:

CodeEditorDelegate delegate = event.getEditor();

If you were using the View directly from events, you’ll need to update that.

Helper for migration

Added this:

@Nullable
public static CodeEditor fromDelegate(@NonNull CodeEditorDelegate delegate)
  • Returns the CodeEditor if you're in View mode
  • Returns null if you're using Compose

Example:

CodeEditor editor = CodeEditor.fromDelegate(delegate);
if (editor != null) {
    // old View logic
}

Compose doesn’t have a View, so passing CodeEditor around in events doesn’t make sense anymore.

CodeEditorDelegate becomes the common layer that works for both:

  • View (CodeEditor)
  • Compose (editor-compose)

Compose usage

val state = rememberCodeEditorState(initialText = "Hello, World!")

CodeEditor(
    state = state,
    modifier = Modifier.fillMaxSize()
)

This is a big change, but it should make future work (especially Compose stuff) much cleaner.

@itsvks19
itsvks19 marked this pull request as draft May 1, 2026 12:53
@itsvks19
itsvks19 marked this pull request as ready for review May 3, 2026 13:10
@itsvks19

itsvks19 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

@Rosemoe merge when?

@Rosemoe

Rosemoe commented Jul 13, 2026

Copy link
Copy Markdown
Owner

I'll review this probably this weekend. It's quite a big change.

@itsvks19

itsvks19 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

I think I need to recreate PR, as this PR is messed up.

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