is there a way to enable soft warp in on line mode EditorTextField

已回答

I want an input EditorTextField, just accept one line input.

sometimes, the input string is too long ,i want to warp it.

the code 

```

editorTextField = EditorTextField(
DocumentImpl("a long text..........."),
project,
FileTypes.PLAIN_TEXT,
false,
true //oneLineMode
)
editorTextField.addSettingsProvider {
it.settings.isUseSoftWraps=true //it only work with the oneLineMode = false
}

```

it doesn't work

0

Using soft wrap in one-line editor is not possible.

0

You can probably make a hack by using a multi-line text field but intercept all actions (key shortcuts) that would insert and EOL and prevent that.

You will also need to intercept paste and remove EOLs or paste only the first line of text.

Another approach, and probably much easier to implement, would be to listen to document changes and remove any EOLs added so the editor only has one line of text at all times.

Since it is not one line text field, you will be able to use soft wrapping mode but since you remove all EOLs it will effectively always have only one line of text.

 

0

Yes, that might work.

0

请先登录再写评论。