Word wrapping in editor?

I made an ordinary, plain-text editor for a concept. This concept is designed to house very large pieces of text. Is it possible to somehow tell MPS to perform basic work wrapping (e.g., wrap on a space), perhaps using the Text Width setting as a guide? I'm using 2.0.6. Thanks!
5 comments
Dmitri,

Seems like it's not possible now to do word wrapping for a property of type string. The only thing you can do is to make your text consist of words (delimited by spaces) and use the indent-layout in editor.
I'll ask our editor guru and maybe he'll offer another solution, but most probably he won't.

Regards,
Mihail
0
Hi, Dmitri!

As Michael properly described, one possible option is to reflect document model in mps. In this case each "word" will be stored as property of separate node, so you can use indent layout to let MPS editor automatically wrap words if necessary.

Another option would be using native control in editor, so it will be responsible for wrapping text. Please let me know if you need more detail about it.
0
Thanks for the reply! My concern with having 'words' as separate entities is that I'd have to add each word separately instead of being able to type in a whole sentence. Please correct me if I'm wrong about this.

Actually, the idea of a native control is interesting, as I would see benefit in having specialized controls for various elements. Would you be so kind as to point me to the documentation that will help me get acquainted with this?
0
My concern with having 'words' as separate entities is that I'd have to add each word separately instead of being able to type in a whole sentence.

Well, I suppose you can create number of right-transforms creating a separate word (new node) if you type "space" and number of handlers processing "backspace" actions and merging two separate words into a single node. Nevertheless, this is not trivial task, but it looks doable with current state of MPS editor.

Actually, the idea of a native control is interesting, as I would see benefit in having specialized controls for various elements.

Unfortunately, there is not documentation covering this aspect of MPS editor now. On the other side, you can try it just by creating new cell of type "swing component" in for editor. To complete native cell definition you just need to open inspector of "swing component" cell and write a code constructing/returning new instance of JCoponent there.
0

Please sign in to leave a comment.