wangp / bower

A curses terminal client for the Notmuch email system
Other
119 stars 11 forks source link

A first try for the two issues mentioned in <https://github.com/wangp/bower/issues/58#issuecomment-695754442>. #75

Closed seifferth closed 3 years ago

seifferth commented 3 years ago

Directly show html in compose when toggled manually

Works pretty well, IMO.

Retain old message pager in compose for resize

Unfortunately, I lost line re-wrapping in this implementation. I believe resizing without line re-wrapping but retaining the pager position, expanded and collapsed parts and such is still better than not retaining any of it, but of course this solution is not ideal.

wangp commented 3 years ago

Unfortunately, I lost line re-wrapping in this implementation. I believe resizing without line re-wrapping but retaining the pager position, expanded and collapsed parts and such is still better than not retaining any of it, but of course this solution is not ideal.

I was thinking about how to handle this. Upon resize, if the new wrap width (respecting ui.wrap_width) does not differ from the old wrap width, there is no need to reformat the text. This might be enough to remove the annoyance factor. Or, if there is no automatic reformatting on resize at all, the user could press = to trigger reformatting like in the thread view.

Note that I intend to disable folding of quoted lines in the compose preview. (I have the commit here but it would conflict with this PR.) I like to look over an entire message before I send it, so I would end up highlighting every fold marker and expanding the text. Without fold markers, there would be nearly no expanded/collapsed state to retain.

wangp commented 3 years ago

If you press e to edit the message, upon returning to the compose screen, it would be ideal to show whichever alternative (text/plain or text/html) that was visible previously.

seifferth commented 3 years ago

Adding a = binding for re-wrapping lines was easy enough. Is re-wrapping enough for =, or would we want it to re-run the filter as well? (Similar to how it also refreshes the result list in thread pager.)

I am still having trouble retaining the state. The main problem is that toggling and folding are handled somewhere deep down in the pager, and it's difficult to expose the current preview state to compose. I'll have another look at the issue some time, though.

wangp commented 3 years ago

Adding a = binding for re-wrapping lines was easy enough. Is re-wrapping enough for =, or would we want it to re-run the filter as well? (Similar to how it also refreshes the result list in thread pager.)

Re-wrapping is enough. (The full refresh in the thread pager is not actually intended, but I haven't bothered to improve it.)

I am still having trouble retaining the state. The main problem is that toggling and folding are handled somewhere deep down in the pager, and it's difficult to expose the current preview state to compose.

Right. I don't think the state needs to be exposed though. setup_pager_for_staging needs to be able to read the relevant state from the old pager_info and apply it to the new pager_info. If (when) we disable folding of quoted lines, I think the only state that would even be available can be found by looking for the part_head line.

wangp commented 3 years ago

Merged, thanks.