cinqmarsmedia / Copy-Editor-A-RegEx-Puzzle-Game

GNU General Public License v3.0
4 stars 1 forks source link

using \ in inputs doesn't work unless it's at the end #6

Open vapier opened 1 year ago

vapier commented 1 year ago

the current logic that looks for \ seems to only work if the cursor is at the end of the input. if it's in the middle, the logic fails.

for example, typing \ ( . works. but if you type \ ., then left arrow (so the cursor is inbewteen the \ and .), then type (, an error message is shown about needing to use literals. you have to manually delete all the content after the cursor in order to enter the ( after the \.

this was on level 13 "No Notes" fwiw.

ccj242 commented 1 year ago

hey @vapier - thanks so much for this. So this is level specific as it relates to tips - currently, it's coded to popup this tip on level 13 iff the keyboardEvent is handling a "(" and the last character in the field is not a "\". This should obviously be the character behind the current caret instead, but as much as that seems like a simple fix, getting the caret position isn't enough since there are hidden characters in the input box, coloring and formatting the text. I will need to think on this. It's an issue for all tips that rely on the preceding character or token, as it currently disregards the cursor when popping the tip up. A lazy stop-gap solution would be to only popup the tip once? I guess what I'll need to do is determine the caret position and then do some calculation where I strip out any html from the input box (I'll use regex!!!! something like .replace(/(<([^>]+)>)/gi,)

I'll try to get to this in the next couple days so it's ready for the next update. Thanks so much, seriously!! Please also let me know if you'd like to try out any of our non-profit's other projects, I'd be happy to send you steam keys and could even share some stuff in beta if you're interested in playtesting.

vapier commented 1 year ago

i did not realize these games were open source or run by non-profit until today. that's kind of cool. The Devil's Calculator looks interesting.

is it helpful to file bugs for other UI issues i've noticed ?

ccj242 commented 1 year ago

Sorry for the delay -- yes, absolutely! I really appreciate all your comments, I'll get to fixing them asap. Shoot us an email at info@cinqmarsmedia.org so I can send you a steam key for the Devil's Calculator. Thanks!