Commit 48cef38
authored
Fix Cursor Lagging - Update Cursors in
### Description
Addresses an issue described by @nkleemann in the linked issue. The issue was a bug where cursors would lag behind an edit. This is due to the edited line's layout information being invalidated by the edit, meaning the selection manager cannot get valid layout information to position cursors.
This change puts a selection position update in the text view's `layout` call, after the layout manager has done it's layout pass. This ensures the selection manage is using valid layout information, fixing the lagging issue.
### Related Issues
* CodeEditApp/CodeEditSourceEditor#317
### Checklist
- [x] I read and understood the [contributing guide](https://github.com/CodeEditApp/CodeEdit/blob/main/CONTRIBUTING.md) as well as the [code of conduct](https://github.com/CodeEditApp/CodeEdit/blob/main/CODE_OF_CONDUCT.md)
- [x] The issues this PR addresses are related to each other
- [x] My changes generate no new warnings
- [x] My code builds and runs on my machine
- [x] My changes are all related to the related issue above
- [x] I documented my code
### Screenshots
On v0.11.2:
https://github.com/user-attachments/assets/f4f23e02-58e5-410b-ba1a-0ea5e449dce4
With this change:
https://github.com/user-attachments/assets/663fdecb-c1dd-43ec-9990-5f8c7da07205TextView.layout (#109)1 parent 7d63a64 commit 48cef38
File tree
2 files changed
+59
-50
lines changed- Sources/CodeEditTextView
- TextSelectionManager
- TextView
2 files changed
+59
-50
lines changedLines changed: 58 additions & 50 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
140 | | - | |
141 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
165 | 154 | | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
171 | 163 | | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
181 | 168 | | |
182 | | - | |
183 | | - | |
| 169 | + | |
184 | 170 | | |
185 | | - | |
186 | | - | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
187 | 180 | | |
188 | | - | |
189 | | - | |
| 181 | + | |
| 182 | + | |
190 | 183 | | |
191 | | - | |
192 | | - | |
193 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
194 | 187 | | |
195 | 188 | | |
196 | | - | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
197 | 201 | | |
198 | | - | |
199 | 202 | | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
204 | 210 | | |
| 211 | + | |
| 212 | + | |
205 | 213 | | |
206 | 214 | | |
207 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
0 commit comments