fountain-atom icon indicating copy to clipboard operation
fountain-atom copied to clipboard

WYSIWYG auto-align dialogues

Open barelief opened this issue 4 years ago • 3 comments

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!

barelief avatar May 18 '20 20:05 barelief

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.

superlou avatar May 19 '20 23:05 superlou

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.

barelief avatar May 21 '20 04:05 barelief

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

superlou avatar Jun 27 '20 21:06 superlou