rhysd / tui-textarea

Simple yet powerful multi-line text editor widget for ratatui and tui-rs
https://crates.io/crates/tui-textarea
MIT License
341 stars 63 forks source link

Alignment for TextArea #3

Closed Volkalex28 closed 2 years ago

rhysd commented 2 years ago

Can you describe the motivation? Setting center or right alignment to text editor sounds strange for me.

I don't think that alignments other than left work with line numbers well.

Volkalex28 commented 2 years ago

Can you describe the motivation? Setting center or right alignment to text editor sounds strange for me.

I don't think that alignments other than left work with line numbers well.

Good day.

Alignment seemed like a good idea to me when this library is used in single line mode. If I want to embed a field somewhere to change the row, I might need to align it to the center or to the right. For example, I needed it to change table cells. Some of the data is strings and numbers. Your library is best suited for this role, but since the cells are aligned in the center according to the style of the table, it is necessary to align in your widget too.

If you want I can test line number alignment when I get a chance and/or fix this functionality

rhysd commented 2 years ago

Thanks for the explanation. I understood you use case and it sounds reasonable. Let me try this branch on my side before merging.

If you want I can test line number alignment when I get a chance and/or fix this functionality

Your use case doesn't seem to need line numbers, so I think simply disabling line numbers would be sufficient. After merging this branch, I'll add the implementation.

rhysd commented 2 years ago

@Volkalex28 Can you fix formatter issue?

cargo fmt
Volkalex28 commented 2 years ago

@Volkalex28 Can you fix formatter issue?

cargo fmt

Yes. I will check

rhysd commented 2 years ago

v0.1.6 was released.