Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix center viewport not working horizontally #93792

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

kitbdev
Copy link
Contributor

@kitbdev kitbdev commented Jun 30, 2024

The wrap condition was inverted, so it never moved horizontally.
It's part of center_viewport_to_caret but it adjusts the caret horizontally instead of centering it intentionally to match other editors, so searching only moves the horizontal scrollbar if needed.
I changed it a bit so that it checks both ends of selected text if it is on one line, so searching for text makes sure it is on screen.
Also added a guard to adjust_viewport_to_caret to match.

@kitbdev kitbdev requested a review from a team as a code owner June 30, 2024 19:09
@KoBeWi KoBeWi added this to the 4.3 milestone Jun 30, 2024
@KoBeWi KoBeWi modified the milestones: 4.3, 4.4 Jul 31, 2024
@kitbdev kitbdev force-pushed the fix-center-viewport-horizontal branch from 643c3ae to 76b00e8 Compare January 15, 2025 19:57
@kitbdev
Copy link
Contributor Author

kitbdev commented Jan 15, 2025

Rebased and fixed conflict.
Moved it into a helper function, because adjust to caret does the same thing.
Split Vector2i caret_pos into 2 ints, since it is never used as a Vector2i and it is more descriptive this way.
Also removed 3 unrelated function definitions. (see #92514 and #92865)

Now also makes adjusting to caret on a single line right-to-left selection show as much of it as it can (ex undoing something).

There is code to scroll to the IME, but it's not working for me, see #101601
I treated the code as if it works for now, the logic should basically be the same.

Copy link
Member

@KoBeWi KoBeWi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs rebase.

@kitbdev kitbdev force-pushed the fix-center-viewport-horizontal branch from 76b00e8 to 46fa858 Compare January 25, 2025 22:55
@kitbdev
Copy link
Contributor Author

kitbdev commented Jan 25, 2025

Rebased
Made sure it works with IME after the fix for it.

Cleaned up the logic a little.

@Repiteo Repiteo merged commit 1c0bff5 into godotengine:master Jan 27, 2025
19 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Jan 27, 2025

Thanks!

@kitbdev kitbdev deleted the fix-center-viewport-horizontal branch January 28, 2025 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Searching in script editor does not scroll horizontally to result
3 participants