kwsch / pkNX

Pokémon (Nintendo Switch) ROM Editor & Randomizer
https://projectpokemon.org/home/forums/topic/48647-pknx-nintendo-switch-rom-editor-randomizer/
GNU General Public License v3.0
339 stars 106 forks source link

SUGGESTION, not an Issue: Regex and application of newlines to script and common #307

Open elayes211 opened 1 year ago

elayes211 commented 1 year ago

Text Editting Suggestion

S and V are really flexible and work with the custom newlines.

I suggest adding a regex and some logic to reapply newlines, when none are found!

I can help with the generation of the regex.

I already own one, let me know if you want me to put it here.

It is not optimized but it works without cutting the [VAR ..............] variables of the text

Thank you for reading, You can lock it anytime, I wont be insulted at all!

Thank you for this awesome app, George!

kwsch commented 1 year ago

String measuring is not something the editor currently does. The text editor is kinda dumb, in that whatever you give it is whatever it uses.

Regex isn't the solution; a font-specific and variable-aware measurer is what is needed. Someone would have to document heuristics, like:

  1. how wide in pixels the textbox is
  2. worst case scenario strings for specific variables (or generally, worst for any variable)

A decent GUI implementation would have multiple modes of linebreak updating:

  1. manual (off)
  2. checked (indicate where text overflows)
  3. auto (prepend words that overflow)
elayes211 commented 1 year ago

Thank you for the valuable info/investigation/analysis.

One precious, yet simple info is the following:

The text that appears on the top of the heads of NPCs, the short message they give before you talk to them, accepts newlines.

In PLA it had to be in our row, SV is more flexible.