godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.14k stars 93 forks source link

In the script editor, make following a link always add to the page history #4462

Open snailrhymer opened 2 years ago

snailrhymer commented 2 years ago

Describe the project you are working on

Generic use of the script editor.

Describe the problem or limitation you are having in your project

When I follow a link in the script editor or built in docs docs that takes me to elsewhere in the same page, I can't use the back button to return to my original position - it takes me to the last page instead.

In the script editor for 3.x (though not the docs), the back button would take you back to the last position on the same page. The online docs (and e.g. Wikipedia) also have this functionality.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Make following any link add to the page history, instead of only when it takes you to another page.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Currently, editor_help scrolls directly to the correct paragraph when a link on the same page is clicked. If instead, it emitted the "go_to_help" signal with topic + ":" + class_name + ":" + link, the desired behaviour is achieved (though I don't know how to get the class name in general).

I imagine something analgous would work for script pages.

If this enhancement will not be used often, can it be worked around with a few lines of script?

It can be worked around by scrolling back to where you were when you clicked the link, but this is mildly inconvenient.

Is there a reason why this should be core and not an add-on in the asset library?

It's core editor funcitonality.

KoBeWi commented 2 years ago

Related: https://github.com/godotengine/godot/issues/16554 I wouldn't limit it only to following links, but for any script jump greater than 9 lines. VS Code has such feature and it's great.

noidexe commented 2 years ago

I was about to post the same proposal. I know the arrow says "Go to previous edited document" but I assume everyone who's ever used a browser is expecting standard back button behavior. Sometimes is really confusing. E.g:

If you are a newbie user this is more than a minor inconvenience. It can be really confusing since the only way to realize you're at the wrong place is noticing all the methods are suddenly different.

snailrhymer commented 2 years ago

See also godotengine/godot#63515 for

I wouldn't limit it only to following links, but for any script jump greater than 9 lines. VS Code has such feature and it's great.