今日已更新 67 条资讯 | 累计 29520 条内容
关于我们

Pure Codename One Text Editing Without Native Overlays

Shai Almog 2026年08月03日 23:39 3 次阅读 来源:Dev.to

PR #5386 adds a pure Codename One text-editing path. EditField , RichTextArea , and CodeEditor can now keep their document, selection, and painting inside the lightweight UI while each port supplies keyboard and input-method events. What is Codename One? Codename One is an open-source framework for building native iOS, Android, desktop, and web apps from a single Java or Kotlin codebase. Learn more at codenameone.com . Text input must handle virtual keyboards, hardware keys, autocorrect, dictation, marked text from an input method editor, bidirectional text, selection, clipboard formats, and accessibility geometry. Codename One traditionally delegates that work to a native platform field placed over the lightweight component during editing. The overlay remains the default for TextField and TextArea . It can create a small visual jump, and it cannot participate in lightweight painting for syntax highlights, rich runs, masks, inline images, or a custom selection model. The port sends text operations instead of key codes A soft keyboard does not type keys. It commits words, replaces a marked composition range, deletes text around the caret, and changes selection. Dictation may insert a sentence without producing one key event. The new TextInputClient contract models those operations: commitText(...) inserts final text. setComposingText(...) replaces the active marked-text range. finishComposing() accepts that range. deleteSurroundingText(...) implements virtual-keyboard deletion. onKeyCommand(...) carries navigation, selection, clipboard, undo, and redo. Geometry queries locate the caret and selection for candidate windows and accessibility. All offsets use UTF-16 indices. That matches Java String , Android Editable , and Apple string APIs. The document normalizes line endings before it updates selection, undo history, formatting runs, or the state returned to the platform. The port still owns the keyboard session. Codename One owns the document and what appears on scr

本文内容来源于互联网,版权归原作者所有
查看原文