Text wrapping in code blocks

Finally decided to organize the notes I have all over different apps, and Bear was the chosen one (fantastic app guys!). One thing that I noticed though, is the use of line-wrapping inside code-blocks, which goes against the standard presentation (i.e. horizontally scrollable once past the available width). It would be great to have a toggle in settings to enable/disable the wrapping (in case anyone actually wants the wrapping). Disabling the wrapping not only would comply with code-blocks’ expected standard behaviour, but would also fix them for Bear on iPhone, which currently “breaks” any code more than a few columns wide.

Thanks for such an awesome app!

PS: Is this the best place for feedback/feature requests?

7 Likes

Just noticed another good example on Bear’s official twitter feed :sweat_smile:

1 Like

Yep, wrapping is not very nice for code. We are considering adding side-scrolling on the code block if the code doesn’t fit, but that is a bit further down the line as it requires an overhaul on how code is rendered.

5 Likes

Gotcha, sad to hear it’s not "a quick fix" :smiling_face_with_tear:

Thanks for the reply! And all the best, really enjoying the app :heart_hands:

Excited to hear that the folks on the inside want this as well. Been asking for this for a long time. Scrolling code blocks and a copy button. Maybe a little extra padding around the edges would be nice as well :stuck_out_tongue_closed_eyes:

Glad to see this thread! Better handling of word-wrapping for code is critical for me - who uses Bear extensively for code-blocks.

I would love the horizontal scrolling for code blocks. I understand that isn’t easy. A few interim steps might be easier and still help a lot:

  1. no max width for code-blocks. On MacOS - if the code blocks were always full-width, enlarging the window would solve this pretty well.
  2. syntax or at least indent-aware wrapping - ideally, syntax-aware wrapping would be great, but just indenting the wrapped line to the same indent it started at would help A LOT. If the indent is, say, more than half the window-width, you could fall back on the current wrapping.

Wondering if this is still on the roadmap for Bear? Might be an idea that this moves to the general “Feature Request”, instead of just panda focused? @trix180 @rexikan

We have a good grasp of what people are asking for through the forum, support, and social media. The exact category on a post doesn’t really matter for that.

Side-scrolling is something that we would like to add eventually, but it is far from trivial to do it would require a sub-view for the code block. So it is a trade-off between the value it provides and the work that is needed to implement and maintain it compared to other features we could decide to implement.

4 Likes

I agree on allowing horizontal scrolling in code blocks.

It is very difficult to read code when then lines automatically wrap in to new lines. This becomes especially difficult to read in programming languages like Python which are highly dependent on lines and indents.

I have used at least a dozen of Markdown editors and almost all of them seem to support horizontal scrolling in code blocks (auto text wrap disabled).

Please implement this feature as it adds a lot of value to developers using Bear for saving their code snippets.

Thank you.

1 Like

+1 to this idea. It bit me today at work. :slight_smile:

1 Like