Bug with highlightTrailingWhitespace() and entering a new line and pressing command + z

Hi, my CM extension setup is plugins_codemirror-editor/web/element/extensions.ts at master · GerritCodeReview/plugins_codemirror-editor · GitHub. The issue I’m having is that when I get a piece of code to go onto a new line, it shows the previous line with whitespace (correct behaviour). Now when I press command + z to revert back to the previous text, it correctly does it but the whitespace stuff is still shown. It’s a bug since reloading the page gets rids of it.

You can see a video here https://imgur.com/a/OlLi6RW

If you can reduce this to a couple of lines of code on codemirror.net/try, I can take a look. If it only occurs with all that custom code loaded, the problem might not be in the library.

Yup I can reproduce on /try as well.

import {javascript} from "@codemirror/lang-javascript"
import {
  EditorView,
  keymap,
  highlightSpecialChars,
  drawSelection,
  lineNumbers,
  highlightActiveLineGutter,
  highlightWhitespace,
  highlightTrailingWhitespace,
} from '@codemirror/view';

new EditorView({
  doc: "console.log('hello')\n",
  extensions: [basicSetup, javascript(), highlightTrailingWhitespace()],
  parent: document.body
})

video: https://imgur.com/a/Nj8U5ju

Thanks, I could reproduce this. This patch should help.

Thank you!!

Is there any chance of a minor release please? :slight_smile:

Yes—I’ve tagged 6.36.8

Thank you so much!