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

4.0, mouse click below code without an empty last line, error: Index p_column = 6 is out of bounds #69011

Closed
duianto opened this issue Nov 22, 2022 · 4 comments · Fixed by #69054

Comments

@duianto
Copy link

duianto commented Nov 22, 2022

Godot version

v4.0.beta5.official [89a33d2]

System information

Windows 10 22H2, OpenGL3, Geforce GTX 550 Ti

Issue description

The Output panel shows an error message like this:

scene/gui/text_edit.cpp:4911 - Index p_column = 6 is out of bounds (text[carets[p_caret].selection.selecting_line].length() + 1 = 6).

When left mouse button clicking below code, without an empty last line.

For example, if one want to select from the last line, upwards, by mouse dragging upwards.

An empty line is added automatically at the end when a script file is saved.
But this error can be encountered if one, for example, copies code from a website,
and it didn't have an ending empty line, or it wasn't included in the selection when the code was copied.

Steps to reproduce

  • Open the included project: error, mouse click below non-empty last line.zip
  • On the bottom panel, open the Output panel
  • In the bottom left FileSystem panel
  • Double-click on the script: new_script.gd
  • In the script editor, erase the last empty line (line 12), leaving pass as the last line
  • Mouse left click below the last line (line 11)

Expected

Nothing should happen.

Observed

The Output panel shows the error message:

  scene/gui/text_edit.cpp:4911 - Index p_column = 6 is out of bounds (text[carets[p_caret].selection.selecting_line].length() + 1 = 6).

Minimal reproduction project

error, mouse click below non-empty last line.zip

A MRP is probably not needed, since it happens in any script without an empty last line, even with the default script template.

@adamscott
Copy link
Member

To cite CONTRIBUTING.md

On the contributors' end, recreating a test project from scratch takes valuable time that can be saved by uploading a minimal project.

To speed up our work, please upload a minimal project that isolates and reproduces the issue. This is always the best way for us to fix it. We recommend attaching a ZIP file with the minimal project directly to the bug report, by drag and dropping the file in the GitHub edition field. This ensures the file can remain available for a long period of time. Only use third-party file hosts if your ZIP file isn't accepted by GitHub because it's too large.

We recommend always attaching a minimal reproduction project, even if the issue may seem simple to reproduce manually.

If you've been asked by a maintainer to upload a minimal reproduction project, you must do so within 7 days. Otherwise, your bug report will be closed as it'll be considered too difficult to diagnose.

Please upload a MRP to the issue's description.

(I know that you say that it happens to any script, but it really helps having a prepared project to test, Thank you!)

@duianto
Copy link
Author

duianto commented Nov 23, 2022

Sorry about that, I added a MRP, and updated the reproduction steps.

@adamscott
Copy link
Member

adamscott commented Nov 23, 2022

I confirm the issue on master (a8a8819).

@adamscott
Copy link
Member

Thanks for the MRP, it really helped!

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

Successfully merging a pull request may close this issue.

3 participants