Closed dstein64 closed 1 year ago
"My motivation for handling this in keylog.rb, rather than e.g., cli.rb, is that the server code would be able to utilize this update as well."
To elaborate, my thought was that an alternative way to handle this would be to have the CLI fix the issue right when reading the keylog file generated by Vim. Then all new submossions from the updated CLI wouldn't have the issue.
But I thought that there may be users that don't update their CLI version frequently, and the current version of the PR would properly handle their entry upon submission (although if they were using an older CLI, the wrong keystrokes and score would still be shown when they're using the application, but not by the webapp after submission).
Upon further thought, I'm less confident in the approach I implemented versus the alternative (having this handled immediately by the CLI when loading the keylog script). If you're interested in the general type of update in this PR (replacing <C-C><C-C>
with <C-C>
, with various possibilities for the actual implementation), please let me know if you have any preference one way or the other.
I'm going to close this for now, to explore the alternative approach I mentioned above.
Vim intentionally replaces
<C-C>
with<C-C><C-C>
, which is reflected in the output when using-W
(https://github.com/vim/vim/issues/11541).In VimGolf, when a user enters
<C-C>
, the input will count as two keystrokes towards the score, showing<C-C>
twice in the displayed keystrokes.This PR updates the code to replace
<C-C><C-C>
with<C-C>
. This will allow the CLI to not double count<C-C>
in the reported keystrokes and score. My motivation for handling this inkeylog.rb
, rather than e.g.,cli.rb
, is that the server code would be able to utilize this update as well. However, without updating the database, which appears to save scores, the scores would presumably still be incorrect for already-submitted solutions.This fixes #224.