Tampermonkey / tampermonkey

Tampermonkey is the most popular userscript manager, with over 10 million users. It's available for Chrome, Microsoft Edge, Safari, Opera Next, and Firefox.
GNU General Public License v3.0
4.37k stars 428 forks source link

Trailing whitespace highlighting+removal in editor doesn't work as expected #1129

Open darkred opened 3 years ago

darkred commented 3 years ago

The issues I noticed are that:

For comparison regarding the former, Sublime Text editor's 'TrailingSpaces' package highlights trailing whitespace as you type/as you still have the curson on the current line.

Thank you

STR 1

Here is a screenshot: ezgif-1-c1dd0855af28

STR 2

// some comment text


- press Save (the script tab will close), reopen the script in the editor
- move the cursor to the latest line, and delete the word `text` leaving 1 trailing space
- press Save (Ctrl-S)
- notice that the trailing space is not removed: 
![2021-01-24_000830](https://user-images.githubusercontent.com/723651/105615325-58db0580-5dd8-11eb-8655-98aeedc8062b.jpg)
- If you move/click the cursor away, then the space gets highlighted, but it doesn't get removed on Save :
![2021-01-24_000843](https://user-images.githubusercontent.com/723651/105615328-62fd0400-5dd8-11eb-8404-441b8b8023d3.jpg)

## Specifications

- Chromium: (88.0.4324.104)
- TM: (beta 4.12.6126)
- OS: (win 10)
darkred commented 2 years ago

I'd like to mention that these issues still occur with latest TM 4.17.6161 (Chrome 102 on win 11).

derjanb commented 1 year ago

I just created a new extension that allows to edit the userscripts of Tampermonkey at vscode.dev (which is basically a VSCode online editor).

I know this does not fix Tampermonkey's internal editor, but it might help. To test it you have to install TM BETA 4.19.6176+ and Tampermonkey Editors 1.0.1.

A click at "Tampermonkey Editors"' icon will take you to vscode.dev and a "folder" with all installed Tampermonkey scripts should be automatically opened.

darkred commented 1 year ago

Thanks for making this new extension. I tested it and works as expected, no issues noticed.

derjanb commented 1 year ago

Note: cm.getDoc().getAllMarks() does not include the change when this happens. This needs further debugging...