Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextField is missing basic features: DEL, selection, navigation, clipboard, singleLine #277

Closed
eekboom opened this issue Jan 15, 2021 · 10 comments
Assignees
Labels
input Touch, mouse, keyboard input related

Comments

@eekboom
Copy link

eekboom commented Jan 15, 2021

I was taking Compose for Desktop for a test drive.
Because our apps are pretty form-heavy, a TextField was one of the first things I tried.
For now it is very alpha. These basic thing do not work:

  • DELETE key handling. This is one of the things that I really hate on mobile. On the desktop I just expect it to work.
  • Navigation to the beginning/end with POS1/END
  • Word-wise navigation using CTRL-LEFT/RIGHT
  • Text selection by holding down SHIFT and using navigation (so both SHIFT-POS1 and SHIFT-LEFT should work for example)
  • Select all by CTRL-A
  • Clipboard support. On Windows please also implement the alternative shortcuts (Copy = CTRL-INS, Paste = SHIFT-INS and Cut = SHIFT-DEL)
  • "singleLine = true" does not really work. Currently it only makes the text field visually "single line". I can still press ENTER, but then the caret and the rest of the text gets invisible.

Of course the shortcuts appropriate for the current system/OS should be used.

I tested both with

    var value by savedInstanceState(saver = TextFieldValue.Saver) { TextFieldValue() }
    TextField(
        value = value,
        onValueChange = { value = it },
        singleLine = true
    )

and

    var text by remember { mutableStateOf("") }
    TextField(
        value = text,
        onValueChange = { text = it }
    )

and the behaviour is the same.

plugins {
    kotlin("jvm") version "1.4.21"
    id("org.jetbrains.compose") version "0.3.0-build140"
}

OS: Windows 10 Pro 20H2

@olonho olonho added the input Touch, mouse, keyboard input related label Jan 18, 2021
@prepor prepor closed this as completed Jan 26, 2021
@prepor prepor reopened this Jan 26, 2021
@igordmn
Copy link
Collaborator

igordmn commented Jan 28, 2021

Drag&drop: #322

@igordmn
Copy link
Collaborator

igordmn commented Jan 28, 2021

Context menu: #323

@git-xiaocao
Copy link

我正在将Compose for Desktop用作测试驱动器。
因为我们的应用程序非常笨重,所以TextField是我尝试的第一件事。
现在,它是_非常_alpha的。这些基本的东西不起作用:

  • 删除键处理。这是我最讨厌手机的一件事。在桌面上,我只是希望它能工作。
  • 导航至POS1 / END的开头/结尾
  • 使用CTRL-LEFT / RIGHT逐字导航
  • 通过按住SHIFT并使用导航来选择文本(例如SHIFT-POS1和SHIFT-LEFT都应起作用)
  • 通过CTRL-A全选
  • 剪贴板支持。在Windows上,还请实现其他快捷方式(复制= CTRL-INS,粘贴= SHIFT-INS和剪切= SHIFT-DEL)
  • “ singleLine = true”实际上不起作用。当前,它仅使文本字段在视觉上“单行”。我仍然可以按ENTER键,但是插入号和其他文本将不可见。

当然,应该使用适合当前系统/ OS的快捷方式。

我都用

    var value by savedInstanceState(saver = TextFieldValue.Saver) { TextFieldValue() }
    TextField(
        value = value,
        onValueChange = { value = it },
        singleLine = true
    )

    var text by remember { mutableStateOf("") }
    TextField(
        value = text,
        onValueChange = { text = it }
    )

和行为是相同的。

plugins {
    kotlin("jvm") version "1.4.21"
    id("org.jetbrains.compose") version "0.3.0-build140"
}

操作系统:Windows 10 Pro 20H2

Have you found a solution?

@eygraber
Copy link
Contributor

I've been playing around with some shortcuts - https://gist.github.com/eygraber/d35cb777f4ce5d6c936774268ac859a1

@prepor
Copy link
Contributor

prepor commented Feb 23, 2021

Hey! Could you please try it with a new M3? https://blog.jetbrains.com/cross-post/jetpack-compose-for-desktop-milestone-3-released/

@timzam
Copy link

timzam commented Feb 25, 2021

I just tried 0.4.0-build168 on Windows and on a Mac (I use BasicTextField) and I don't see any changes from before. Undo, selection, copy/paste, delete, home/end - they all don't work for me.

@kropp
Copy link
Member

kropp commented Feb 25, 2021

@timzam these changes are not included in 0.4.0 yet, use 0.3.0

@timzam
Copy link

timzam commented Mar 2, 2021

@kropp I just checked 0.3.1 and all features I mentioned in my previous message work there.

@git-xiaocao
Copy link

Does the current version support context menu? If not, which version will it support?

@prepor prepor closed this as completed Mar 30, 2021
MatkovIvan pushed a commit to MatkovIvan/compose-multiplatform that referenced this issue May 10, 2023
* fix the cursor height on a new empty line

coerce its height AtMost to the font ascent (only for newEmptyLine). If it's not new empty line, we keep the original cursor height
@okushnikov
Copy link

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
input Touch, mouse, keyboard input related
Projects
None yet
Development

No branches or pull requests

9 participants