@@ -2249,6 +2249,9 @@ impl Editor { |
| 2249 | let line_len = line_lens.get(new_line).copied().unwrap_or(0); | 2249 | let line_len = line_lens.get(new_line).copied().unwrap_or(0); |
| 2250 | let new_col = cursor.desired_col.min(line_len); | 2250 | let new_col = cursor.desired_col.min(line_len); |
| 2251 | cursor.move_to(new_line, new_col, extend_selection); | 2251 | cursor.move_to(new_line, new_col, extend_selection); |
| | 2252 | + } else { |
| | 2253 | + // On first line, move to start of line |
| | 2254 | + cursor.move_to(0, 0, extend_selection); |
| 2252 | } | 2255 | } |
| 2253 | } | 2256 | } |
| 2254 | self.cursors_mut().merge_overlapping(); | 2257 | self.cursors_mut().merge_overlapping(); |
@@ -2264,6 +2267,10 @@ impl Editor { |
| 2264 | let line_len = line_lens.get(new_line).copied().unwrap_or(0); | 2267 | let line_len = line_lens.get(new_line).copied().unwrap_or(0); |
| 2265 | let new_col = cursor.desired_col.min(line_len); | 2268 | let new_col = cursor.desired_col.min(line_len); |
| 2266 | cursor.move_to(new_line, new_col, extend_selection); | 2269 | cursor.move_to(new_line, new_col, extend_selection); |
| | 2270 | + } else { |
| | 2271 | + // On last line, move to end of line |
| | 2272 | + let line_len = line_lens.get(cursor.line).copied().unwrap_or(0); |
| | 2273 | + cursor.move_to(cursor.line, line_len, extend_selection); |
| 2267 | } | 2274 | } |
| 2268 | } | 2275 | } |
| 2269 | self.cursors_mut().merge_overlapping(); | 2276 | self.cursors_mut().merge_overlapping(); |