twinejs icon indicating copy to clipboard operation
twinejs copied to clipboard

2.4.0 Passage link suggestion menu closes at first space typed

Open hituro opened this issue 2 years ago • 2 comments

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

  • [ ] I am interested in working on code that would fix this bug. (This is not required to submit a bug report.)
  • [X] I have done a search and believe that an issue does not already exist for this bug in the GitHub repository.
  • [X] I have read and agree to abide by this project's Code of Conduct.

hituro avatar Jul 06 '22 09:07 hituro

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

klembot avatar Jul 07 '22 00:07 klembot

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.

hituro avatar Jul 07 '22 07:07 hituro