superlou / fountain-atom

Grammar and tools for the Fountain screenwriting syntax
MIT License
48 stars 15 forks source link

WYSIWYG auto-align dialogues #102

Open barelief opened 4 years ago

barelief commented 4 years ago

Hello! First, I'd like to say big thanks for the library! I wrote few scripts already!

I was wondering if it's hard to make auto align dialogue elements in the editor, meaning when I write CHARACTER NAME, parentheses and dialog it will jump automatically to the center of the line (just the preview, no saving to file)?

here's what I mean:

https://youtu.be/uTECQBDF3Jo

This is implemented in highland 2 and in Emacs Fountain and I seems to be very organic experience.

Thanks!

superlou commented 4 years ago

A long time ago, I made a prototype called ScriptJr based on Codemirror that would do exactly that. It's definitely a feature I really wanted to have, because I felt it made skimming the drafts much easier.

However, when i made fountain-atom, there was an issue with how cursor positioning is calculated that wouldn't allow centering text. There is a lot of behind-the-scenes optimization to make Atom performant that makes assumptions on where lines show up. You can actually test it naively via CSS's text-align, but then you can have cursor placement issues, especially at the first character of a centered line. When I asked around on the forum, it was considered an accident to be able to center and not supported.

If we can find an example of a right way to do it, I'm all for adding it as an option.

barelief commented 4 years ago

Hey! thanks for your answer!

Is there a same issue with cursor of you use padding like here:

https://codepen.io/barelief/pen/dyYayaq

?

in emacs autoformatting is not immediate, there is a slight delay, but it doesn't seem to be an issue though. So my suggestion is that autoformatting could take place after you press Enter.

superlou commented 4 years ago

Unfortunately, the issue isn't with viewing centered text. That seems to work fine. The problem is editing it and the cursor placement algorithm.