owl icon indicating copy to clipboard operation
owl copied to clipboard

Proposal: add word wrapping

Open alexslade opened this issue 1 year ago • 4 comments

If I try to use a string that is too long, I see naive wrapping.

"Very Long Line" |> Owl.Box.new(max_width: 4, border_style: :none)
Very
 Lon
g Li
ne  

It would be nice if this wrapped to

Very
Long
Line

Any pointers on where to start adding this, and how feasible it might be?

alexslade avatar Jun 25 '23 15:06 alexslade

Hi @alexslade

Yes, this is a nice feature.

Any pointers on where to start adding this, and how feasible it might be?

I think a combination of Owl.Data.split/2 and Owl.Data.length/1 can help with this.

fuelen avatar Jun 25 '23 15:06 fuelen

I'd like to pick this up. :) Is there a document about contribution? I can't seem to get the tests to run (cannot compile :ssl_verify_fun).

And would simply not considering the first space while chunking be a sufficient implementation or is the idea to have nice wordwraps where we push a whole word to the newline if it fits?

janssen-io avatar Dec 15 '23 19:12 janssen-io

Is there a document about contribution?

Just send a PR :slightly_smiling_face:

I can't seem to get the tests to run (cannot compile :ssl_verify_fun).

What is the error? What version of Elixir and Erlang do you use? Try https://github.com/fuelen/owl/blob/7e94c68fff3e560f3db3b51b016e77c47e9b79be/.github/workflows/ci.yml#L12-L13

I think it is better to start with a simpler implementation

fuelen avatar Dec 16 '23 21:12 fuelen

Running 25/1.14 on Debian on WSL

Erlang/OTP 25 [erts-13.1.5] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit:ns] Elixir 1.14.0 (compiled with Erlang/OTP 24)

Doing a mix deps.update --all seemed to have resolved the issue. App compiles and tests run successfully locally now. :)

I think it is better to start with a simpler implementation

I'll get started with chunking by leading-trimmed lines then!

janssen-io avatar Dec 16 '23 21:12 janssen-io

Hey guys, I added word wrapping, and it is available in v0.10.0 :tada:

fuelen avatar Jul 20 '24 14:07 fuelen