What bug causes the 2nd character of a keystroke to

… double type in the module editor?

Whatever that bug is, I’d like to see it squashed.

For example, I type a keystroke “delete” into a Trigger or whatever, and sometimes it inputs as “deelete”.

This happens with annoying frequency (1 in 20 keystroke entries?) and is not keyboard-specific. They are not typos I make in any other medium.

Just to clarify you mean, when you type the letters “d”, “e”, “l”, etc… You don’t mean when you press the “DEL” key. Perhaps the keys on your keyboard are sticky?

Yes, typing d e l e t e.

It is not keyboard specific, occuring on two very different good quality keyboards, and does not occur during typing in any other situation. I type ~2000 words a day at work, so I would notice if there were a problem with that keyboard.

Operating system?
Vassal version?

Windows 10, Vassal 3.2.17, but it was also a problem years ago using Windows 7 and in previous Vassal versions.

To rule out that it is a problem with Java, have you tried Vassal 3.3.0 already that has been released a few days ago?

I’ve seen this many times, and I didn’t respond because I didn’t think it was a big deal. It happens when I enter a key code, e.g. a control-G in a global key command. Except I decide to enter a string instead, e.g. “goToTray”. Vassal has to figure out if I’m entering a single key (control-G) or I’m keying in a long string.

If I type slowly, first it will think I’m typing ‘g’ and then changing my mind to ‘o’–in each case it thinks I’m entering a single hot-key character. If I type it fast (the first 3 characters, “goT…”), then it realizes it’s a string I want, and there is no problem. But if I type “goT” not too fast and not too slow but JUST RIGHT, it will get confused and double up the ‘o’, so I get “gooT…” I’m guessing this would be a gigantic pita to fix, and in the world of vassal bugs, it’s a mere mosquito.

I know it may sound snarky, but my answer would be: type faster.

It’s good to have confirmation, thanks.

I disagree that this is a minor bug. I type more slowly than usual in the Vassal editor because tracking down bugs later is extremely time-intensive, but this can be a cause of exactly the kind of awkward to track down bugs that I am trying to avoid.

I will see if typing consistently faster does the trick. I had thought the cause might have been typing too fast, so it’s nice to be able to rule that out.

If speed is a factor, is there some hard-coded timing factor in the code that decides what is a hot-key and what a string? If there is, should that be configurable?

I would love to be able to disable “hotkey” keystrokes for the duration of an editing session while I type out a hundred strings.

Or to be able to copy and paste normally.

Oh wow, yes, that would make things much easier too.

There is no magic ‘timing factor’, I think it is due to a race condition in the code (NamedHotKeyConfigurer). The KeyListeners are firing off while the last key is still being processed. It should be able to be fixed.

However, another option is to completely replace the NamedHotKeyConfigurer.

The dual Hotkey/NamedHotkey editor seemed like a good idea at the time ™ when we introduced Named KeyCommands as it did not take up any extra room in the trait config dialogs. However, it is not an ideal solution for several reasons:

  • It has this bug.
  • Adding support for cut/paste in it’s current form will not be easy (what if you want Ctrl-V as a key command?).
  • It is far from intuitive. It is not obvious that you can keep typing and that this does something different to a single key, or that you need to type reasonably fast.

It would be better if it had some sort of selecting mechanism to switch between the two modes. Perhaps as simple as two side by side fields, the first field for the Keystroke, the second field for the Name. Typing in the name field would take precedence and clear and disable the keystroke field. We would not have change Vassal at all, just the NamedHotKeyConfigurer.

I love that solution, Brent! I get lots of bites from this particular mosquito, just had assumed I was stuck with it for historical reasons.

I too fully support this idea. However I think I may have spotted a potential design pitfall.

Suppose I am learning how to do VASSAL module creation and I see say “CTRL S”. How do I know that to replicate that I am supposed to do a “CTRL S” rather than type “C”, “T”, “R”, “L”, " ", “S”? At the moment it may feel daft, malfuctiony and quirky, but at least one learns pretty quickly (or gives up on editing VASSAL modules).

Maybe in the key command side (as a opposed to the string command), one should convert a string representation of a key command into the actual key command.