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

Dropping to Script Editor is broken if scrolling past end of file is enabled #59822

Closed
KoBeWi opened this issue Apr 3, 2022 · 5 comments
Closed

Comments

@KoBeWi
Copy link
Member

KoBeWi commented Apr 3, 2022

Godot version

3.5 beta3

System information

Windows 10 x64

Issue description

When you enable text_editor/cursor/scroll_past_end_of_file in editor settings and try to drop a file into the script, dragging over the area under the script will cause scrolling down and makes the editor unusable:
godot_RN52PSq21w

Does not happen on master.

Steps to reproduce

  1. Enable scroll past end of file
  2. Open some script that can scroll
  3. Try dropping some file

Minimal reproduction project

No response

@akien-mga
Copy link
Member

akien-mga commented Apr 28, 2022

I can confirm the regression in 3.5 beta 2, 3.5 beta 3 and latest 3.x.
It doesn't happen in 3.4.4-stable or 3.5 beta 1, so the regression happened between beta 1 and beta 2.

@akien-mga
Copy link
Member

I haven't tested but from reviewing the changelog I have a hunch that it might be because of #55355. CC @ConteZero

@ConteZero
Copy link
Contributor

Yes, the problem is in the following code:

		if (drag_action && can_drop_data(mm->get_position(), get_viewport()->gui_get_drag_data())) {
			drag_caret_force_displayed = true;
			Point2 mp = get_local_mouse_position();
			int row, col;
			_get_mouse_pos(Point2i(mp.x, mp.y), row, col);
			cursor_set_line(row, true);
			cursor_set_column(col);
			if (row <= get_first_visible_line()) {
				_scroll_lines_up();
			} else if (row >= get_last_full_visible_line()) {
				_scroll_lines_down();
			}
			dragging_selection = true;
			update();
		}

But I don't know how to fix it.

@KoBeWi
Copy link
Member Author

KoBeWi commented Jun 12, 2022

The easiest "fix" would be removing this part:

if (row <= get_first_visible_line()) {
	_scroll_lines_up();
} else if (row >= get_last_full_visible_line()) {
	_scroll_lines_down();
}

It would disable scrolling when dragging at the edges, but it's better than breaking the editor. From my experience, most dragging operations happen on a single screen.

@akien-mga
Copy link
Member

Fixed by #61980.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants