### Godot version

8449592d92eaeef990f5502b419d491ee3eeb7a6

### System information

Windows 11

### Issue description

Zooming in the script editor on an empty script freezes the entire editor for a few seconds, but if the file is large then it freezes for 4-5 seconds (which is unacceptable). Looks like a recent regression.

### Steps to reproduce

Just zoom in/out on the large script file.

### Minimal reproduction project

N/A
word_start = -1;
				word_length = 0;
			}
		} else {
			if (word_start == -1) {
				word_start = i;
				if (p_chars_per_line <= 0) {
					ret.push_back(line_start);
					ret.push_back(line_end + 1);
					line_start = word_start;
					line_end = line_start;
				}
			}
			word_length += 1;
			if (p_chars_per_line > 0) {
				if (word_length > p_chars_per_line) {
					
					ret.push_back(line_start);
					ret.push_back(i);
					line_start = i;
					line_end = i;
					word_start = i;
					word_length = 1;
				} else if (i - line_start + 1 > p_chars_per_line) {
					
					ret.push_back(line_start);
					ret.push_back(line_end + 1);
					line_start = word_start;
					line_end = line_start;
				}