joostkremers / writeroom-mode

Writeroom-mode: distraction-free writing for Emacs.
BSD 3-Clause "New" or "Revised" License
607 stars 28 forks source link

Emacs -nw resize issue with ultrawide display #73

Closed Shooooooooo closed 2 years ago

Shooooooooo commented 2 years ago

Hi, I am running doom emacs in -nw mode with writeroom-mode turned on. It worked flawlessly with my previous monitors. I recently switched to an ultrawide monitor 5120x1440. And I am now seeing an issue when I change the terminal from fullscreen to halfscreen or smaller, where emacs refuses to redraw the frame and shows a blank screen. (with other monitors, it redraw and recenter the content) I am a bit clueless as how to debug this issue, since the whole frame is blank and I could not print any variables to examine. This issue does not seems to appear when I turn global-writeroom-mode off. Could you shed some light on how this issue could happen?

The (frame-width) is 510 when running fullscreen.

Thank you.

joostkremers commented 2 years ago

That's a difficult question. If you're using emacs -nw, I assume you're running it inside a terminal emulator. If that is the case, it's possible that the problems is (partly) with the terminal, not (just) with Emacs.

Things you could try to see if you can pinpoint the culprit:

The most likely culprit in such cases is the fullscreen effect, so I suspect that as soon as you take that out of the mix, the problem will go away. That doesn't mean the underlying bug is solved, of course, but it may be a viable work-around.

Let me know if you find anything.

Shooooooooo commented 2 years ago

I can almost eliminate the possibility of a terminal emulator issue because I am running emacs -nw under tmux, and other tmux windows redraw just fine. I have tried setting writeroom-fullscreen-effect to both values, and it doesn't seem to fix the issue. emacs -Q -nw seems to fix the issue. So it's likely that the issue has something to do with how doom-emacs configs the package. I will spend some time to look into a bit more once I get the chance. Feel free to close the issue as this may not be an issue with writeroom-mode itself. And thanks for the advice!

Shooooooooo commented 2 years ago

Closing this issue. I am eventually able to narrow the issue down to a line in my config file: (add-to-list 'writeroom-major-modes ".*") ;; Turns on writeroom for all modes It seems like this is a dangerous thing to do. Even though I did not get to the bottom of it, swapping out this big hammer with only prog-mode seems to fix the issue.

joostkremers commented 2 years ago

I would certainly advise against using writeroom-mode in all buffers. IMHO writeroom-mode only really makes sense in text and programming buffers (personally, I don't even use it in programming buffers, actually), so I don't test it with other types of buffers and I can't guarantee it'll work.