Commit 879a219
committed
Fix non-native full screen bad interaction with window delegate
This issue was detected when adding new tests for non-native full
screen. When setting 'fuoptions' to empty and going full screen, the
code would fail but also crash, due to a number of issues:
1. `enterFullScreen`'s setting of presentationOptions somehow triggers a
window resize on the normal window, which leads to `windowDidResize`
delegate being called. This is a degenerate situation as the window
controller thinks we are already in full screen even though we
haven't finished setting up yet, and in particular `nonFuVimViewSize`
is still 0. This leads to the desired desired frame size being set
incorrectly to 0.
2. `constrainRows:columns:toSize` does not sanity check the results when
we have such degenerate small sizes, and end up calculating a desired
rows to -1, which makes no sense. This leads to various wrong
calculations.
3. MMCoreTextView loops through the grid using a size_t even though
grid.rows is an int. This is a poor code practice in general and
results in a crash as the loop comparison cast the -1 to size_t and
the loop didn't correctly terminate.
Fix 1 (the root cause) by making sure we detact the window delegate
immediately when entering full screen to prevent any stray window
messages from causing issues. Also safeguard `windowDidResize` so it
only handles the full screen path if we have `fullScreenEnabled` set.
For 2 and 3, add the sanity checks and also fix the size_t to use int
when looping.
For some reason this issue only showed up in CI but not in local
testing, probably due to different screen environments.1 parent 2b136db commit 879a219
4 files changed
Lines changed: 30 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
831 | 831 | | |
832 | 832 | | |
833 | 833 | | |
834 | | - | |
| 834 | + | |
835 | 835 | | |
836 | 836 | | |
837 | 837 | | |
| |||
1276 | 1276 | | |
1277 | 1277 | | |
1278 | 1278 | | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
1279 | 1282 | | |
1280 | 1283 | | |
1281 | 1284 | | |
| |||
1285 | 1288 | | |
1286 | 1289 | | |
1287 | 1290 | | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
1288 | 1294 | | |
1289 | 1295 | | |
1290 | 1296 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
139 | 148 | | |
140 | 149 | | |
141 | 150 | | |
| |||
162 | 171 | | |
163 | 172 | | |
164 | 173 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | 174 | | |
173 | 175 | | |
174 | 176 | | |
| |||
181 | 183 | | |
182 | 184 | | |
183 | 185 | | |
184 | | - | |
| 186 | + | |
185 | 187 | | |
186 | 188 | | |
187 | 189 | | |
| |||
196 | 198 | | |
197 | 199 | | |
198 | 200 | | |
| 201 | + | |
199 | 202 | | |
200 | | - | |
| 203 | + | |
| 204 | + | |
201 | 205 | | |
202 | 206 | | |
203 | 207 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
895 | 895 | | |
896 | 896 | | |
897 | 897 | | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
898 | 901 | | |
899 | 902 | | |
900 | 903 | | |
| |||
903 | 906 | | |
904 | 907 | | |
905 | 908 | | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
906 | 912 | | |
907 | 913 | | |
908 | 914 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1307 | 1307 | | |
1308 | 1308 | | |
1309 | 1309 | | |
1310 | | - | |
1311 | | - | |
1312 | | - | |
| 1310 | + | |
1313 | 1311 | | |
1314 | 1312 | | |
1315 | 1313 | | |
| |||
1318 | 1316 | | |
1319 | 1317 | | |
1320 | 1318 | | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
1321 | 1322 | | |
1322 | 1323 | | |
1323 | 1324 | | |
| |||
0 commit comments