Git Product home page Git Product logo

Comments (10)

joostkremers avatar joostkremers commented on July 17, 2024

Strange, and unfortunately I can't replicate it. What OS and Emacn version are you using?

The fact that window-total-width returns an incorrect value suggest that it's a problem between Emacs and full-screen on your system, though. Not sure if I can do much about it in that case.

What happens if you build a small pause into writeroom--calculate-width?

(defun writeroom--calculate-width ()
  "Calculate the width of the writing area."
  (if (floatp writeroom-width)
      (progn
	(sleep-for 2)
        (message "%s" (window-total-width))
	(truncate (* (window-total-width) writeroom-width)))
    writeroom-width))

Perhaps it takes a few moments for the UI to catch up...

from writeroom-mode.

ACEMerlin avatar ACEMerlin commented on July 17, 2024

yes, It works correctly with a tiny pause. After reading the document, I suggest the following code to fix this:

...
  (redisplay)
  (setq visual-fill-column-width (writeroom--calculate-width)
...

Of course, you can put (redisplay) anywhere you like

from writeroom-mode.

joostkremers avatar joostkremers commented on July 17, 2024

Honestly, I'm a little hesitant to add (redisplay), because I don't know if it's the right way to deal with this. I've asked on the Emacs mailing list and will let you know if and when I get an answer.

If people advise me against adding (redisplay), it'll still be fairly easy to solve your issue, though. You could simply write a custom fullscreen function that calls (redisplay) and use that instead of the default fullscreen option. I'd be happy to help with the details.

But let's first wait and see what the mailing list says.

from writeroom-mode.

joostkremers avatar joostkremers commented on July 17, 2024

I received some answers to my questions, but I haven't had time to go into them yet. My suggestion would be to add the (redisplay) to your local copy of writeroom-mode.el for the moment. Once I implement a permanent solution, I'll let you know.

from writeroom-mode.

ACEMerlin avatar ACEMerlin commented on July 17, 2024

got it, thx

from writeroom-mode.

joostkremers avatar joostkremers commented on July 17, 2024

I pushed a commit to the devel branch that hopefully fixes this. The cause of the problem is simply a race condition between the WM enabling full screen and Emacs. The fix involves calculating the width of the text area in the hook window-size-change-functions, which should run once full screen has been enabled. Apparently, however, there's no guarantee that this will indeed be the case...

Could you try the devel branch and see if it solves the issue for you?

from writeroom-mode.

joostkremers avatar joostkremers commented on July 17, 2024

I just found that my proposed solution causes an annoying bug if a user doesn't actually activate full screen, so I'm gonna have to try and think of something else...

from writeroom-mode.

ntdef avatar ntdef commented on July 17, 2024

I seem to be experiencing this issue too now. Does the redisplay fix not work?

from writeroom-mode.

joostkremers avatar joostkremers commented on July 17, 2024

With redisplay, the chances of getting a correct result are better, but the underlying problem isn't solved, so I haven't adopted it. I've been meaning to look for a better solution but never got round to it.

from writeroom-mode.

ntdef avatar ntdef commented on July 17, 2024

from writeroom-mode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.