miniscruff/changie

`changie new` editor is incredibly narrow

Closed this issue · 7 comments

Thanks for submitting a bug report, please fill in the following details.

Description
When I run changie new I get an editor that gives me barely 30 characters to edit with:

image

This makes it very difficult to actually write a useful message!

Reproduction Steps
Steps to reproduce the behavior:

  1. Run changie new
  2. Choose a kind
  3. Write a message

What happened
I get about 40 columns to edit in and then it starts scrolling.

Expected behavior
No UI fanciness at all, just let me type and let my terminal do the rest.

Additional context
I would also be happy if I could just write with $EDITOR. This would also have the benefit of giving me syntax highlighting.

Currently the only option is to set the body to block mode https://changie.dev/config/#bodyconfig-block

I do think using an editor is a good idea but feel like it may need to be an env var or something. Not sure.

towncrier uses --edit, maybe that would fit here too?

Yea I was thinking a --editor flag on new to override the body config. The issue comes with newlines. For example if your change format assumes a single line for your body, the body input will enforce that. But using your editor will not.

What should changie do in that case? Should it block bodies with newlines. Or ignore it?

I didn't know changie didn't allow newlines in change log messages, but I suppose that a question for changie overall. I do use newlines in individual change log entries in general though (e.g., https://hackage.haskell.org/package/rel8-1.4.1.0/changelog has a few multi-paragraph bullet points). We would probably need to answer the question of whether or not changie should support newlines first though.

If it's not currently supported I would:

  1. Launch the editor
  2. Check the outcome for newlines
  3. If there are new lines display an error message and wait for the user to indicate they are ready to continue
  4. Re-launch the editor with the change log entry so the user can remove newlines.

Changie supports newlines iff you specify in the body config to use "Block" mode. Then you get a text input that supports newlines and you just need to make sure your change format expects and deals with newlines however it needs to. The issue comes up if you do not have block mode enabled and someone tries using there editor to edit the body.

As you suggested the flow would be to not accept the body and to relaunch the editor, similar to any other validation. Maybe you just need to enable block mode and see how the editing feels in that. I think the logic above for --editor should be fine. I am wondering if it should apply to custom inputs as well. Like maybe --editor overrides the default text block input for any text block custom type as well. Hard to say.

Oh, you are creating full on code samples in your changelogs, got it. Then yea using your editor makes way more sense. One of the core reasons for switching to bubbletea was to use the exec process feature to launch your editor for this particular reason. I just have not needed it myself yet to develop it. Basically this example: https://github.com/charmbracelet/bubbletea/blob/master/examples/exec/README.md having a use case of writing entire code samples is something I was missing.

Closing in favor of #505
Reopen if you believe this is incorrect.