klembot / twinejs

Twine, a tool for telling interactive, nonlinear stories
https://twinery.org
GNU General Public License v3.0
2k stars 296 forks source link

2.4.0 Passage link suggestion menu closes at first space typed #1176

Open hituro opened 2 years ago

hituro commented 2 years ago

Describe the bug.

When typing a passage link, a suggestion menu appears with matching passage names. However the passage suggestion list closes as soon as a space is typed, either in the passage name or link name.

Steps to reproduce:

  1. Name a passage "Passage Name"
  2. Open a new passage and start typing a link [[Passage, "Passage Name" is suggested
  3. Type a space [[Passage, the hint menu dissapears

Expected behavior:

The hint menu does not dissapear

Additional context on this problem.

I think the problem is the use of extraKeys in: https://github.com/klembot/twinejs/blob/7c27fc6cf20337292b28e31ed772bc572e761c09/src/store/use-codemirror-passage-hints.ts#L10-L12

According to the CodeMirror documentation for showHint, extraKeys causes the list of characters provided (in this case ], -, |) to be appended to the standard CodeMirror key list that closes the hint, which includes white space (/[\s()\[\]{};:>,]/_. Using customKeys instead, replaces the standard list.

I suggest using customKeys instead of extraKeys would fix the issue.

Twine version number

2.4.0

Does this problem occur with the web version of Twine or the desktop app?

Desktop app

What operating system does this problem occur on?

Other

If this problem is occurring with the web version of Twine, what browser does it occur on?

No response

Presubmission checklist

klembot commented 2 years ago

This is 2.3 behavior too, so I'm going to change this to an enhancement.

hituro commented 2 years ago

That's fair, thought it was a bug there too. I think I previously submitted an issue on it, but was too lazy to identify the cause in code.