Lissy93 / dashy

🚀 A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!
https://dashy.to
MIT License
18.15k stars 1.37k forks source link

[BUG] Config editor "Code" mouse click inaccuracy #124

Closed UrekD closed 3 years ago

UrekD commented 3 years ago

When trying to edit the config via web settings "Edit config" in type "Code" mouse click and the cursor position don't match 99% of the time, making it really hard to edit code fast and effectively. See GIFs below. Tested in Edge, Firefox (outdated), Brave and Chrome.

WdkW7NmDWF ptAaWnuq6f

Inrego commented 3 years ago

I'm not sure if my issue is related. But for me, it's way worse. The caret is showing a few characters to the left of where it actually is. It worsens the longer the line is.

Example: image This is the last position of this line. Tapping right arrow on my keyboard will move the caret to next line. Typing anything will add characters after that last comma.

I'm using Microsoft Edge. and have confirmed same issue on Chrome (both are Chromium browsers, so it makes sense)

UrekD commented 3 years ago

@Inrego yeah it's the same issue. It's as bad as you describe as you suggest it might be due to longer lines as in the 2nd gif at the end you can see when I double click I believe "Supermicro" you see it's offset by quite a few characters and editing it is as you described.

Lissy93 commented 3 years ago

This is indeed an issue, although I've not been able to fix it so far. I will leave this issue open, and if either of you feel like submitting a PR for it, that would be awesome :)

liss-bot commented 3 years ago

This issue has gone 6 weeks without an update. To keep the ticket open, please indicate that it is still relevant in a comment below. Otherwise it will be closed in 5 working days.

UrekD commented 3 years ago

Should still be relevant. Thanks for the hard work :)

Lissy93 commented 3 years ago

Just a quick update - I haven't forgotten about this, but it's proving not so simple to diagnose.

I believe the issue is with the JSON editor plugin that I'm using rather than Dashy, and I think it has something to do with varying character widths. Similar issues were raised in the past on the plugin, but no clear solutions

For me, I've only been able to re-create the issue once, and I can't remember what I did to get there. Using Brave 1.30, or Firefox 93 on Linux, with a small-ish config file, I don't see the bug. Will keep this issue open, but if anyone has any ideas on a fix, or any more info, that would be really helpful :)

UrekD commented 3 years ago

Playing around with inspect element I think I found the issue, it seems to be the font it gets from css class html .jsoneditor instead of the correct one from .ace-jsoneditor , deactivating the font from .jsoneditor * fixed it, see below for refference.

image

Lissy93 commented 3 years ago

Thank you so much @UrekD for fixing this, nice work! 🙌🥳 PR #315 is now merged and available on DockerHub and changes visible in the dev environment: dev.dashy.to

There's also a new config editor, merged in #298, and released in V 1.9.0, which doesn't require you to write JSON anymore, and may be helpful to some of you.