@@ -294,16 +294,27 @@ impl EditorView {
296 let selection_style = theme.get("ui.selection");
296 let selection_style = theme.get("ui.selection");
297+ let primary_style = theme
298+ .try_get("ui.selection.primary")
299+ .unwrap_or(selection_style);
300+ let selection = doc.selection(view.id);
301+ let primary_idx = selection.primary_index();
298− for selection in doc
303+ for (i, selection) in selection
301− .filter(|range| range.overlaps(&screen))
306+ .filter(|(_, range)| range.overlaps(&screen))
303 // TODO: render also if only one of the ranges is in viewport
308 // TODO: render also if only one of the ranges is in viewport
304 let mut start = view.screen_coords_at_pos(doc, text, selection.anchor);
309 let mut start = view.screen_coords_at_pos(doc, text, selection.anchor);
305 let mut end = view.screen_coords_at_pos(doc, text, selection.head);
310 let mut end = view.screen_coords_at_pos(doc, text, selection.head);
312+ let style = if i != primary_idx {
307 let head = end;
318 let head = end;
309 if selection.head < selection.anchor {
320 if selection.head < selection.anchor {
@@ -331,7 +342,7 @@ impl EditorView {
334− selection_style,
345+ style,
337 surface.set_style(
348 surface.set_style(
@@ -342,7 +353,7 @@ impl EditorView {
342 viewport.width.saturating_sub(start.col as u16),
353 viewport.width.saturating_sub(start.col as u16),
345− selection_style,
356+ style,
347 for i in start.row + 1..end.row {
358 for i in start.row + 1..end.row {
348 surface.set_style(
359 surface.set_style(
@@ -353,7 +364,7 @@ impl EditorView {
353 viewport.width,
364 viewport.width,
356− selection_style,
367+ style,
359 surface.set_style(
370 surface.set_style(
@@ -363,7 +374,7 @@ impl EditorView {
363 (end.col as u16).min(viewport.width),
374 (end.col as u16).min(viewport.width),
366− selection_style,
377+ style,