the implementation of a variant of the `copy_selection_on_line` function that uses visual lines and respects virtual text

pull/13790/head
Dubrovin E. Iu. 2025-06-17 17:46:06 +03:00
commit 4d374ed747
2 changed files with 5 additions and 4 deletions

View File

@ -2047,8 +2047,6 @@ fn copy_selection_on_visual_line(cx: &mut Context, direction: Direction) {
// currently uses the deprecated `visual_coords_at_pos`/`pos_at_visual_coords` functions // currently uses the deprecated `visual_coords_at_pos`/`pos_at_visual_coords` functions
// as this function ignores softwrapping (and virtual text) and instead only cares // as this function ignores softwrapping (and virtual text) and instead only cares
// about "text visual position" // about "text visual position"
//
// TODO: implement a variant of that uses visual lines and respects virtual text
fn copy_selection_on_line(cx: &mut Context, direction: Direction) { fn copy_selection_on_line(cx: &mut Context, direction: Direction) {
use helix_core::{pos_at_visual_coords, visual_coords_at_pos}; use helix_core::{pos_at_visual_coords, visual_coords_at_pos};

View File

@ -252,6 +252,9 @@ fn diag_picker(
.into() .into()
}, },
), ),
ui::PickerColumn::new("source", |item: &PickerDiagnostic, _| {
item.diag.source.as_deref().unwrap_or("").into()
}),
ui::PickerColumn::new("code", |item: &PickerDiagnostic, _| { ui::PickerColumn::new("code", |item: &PickerDiagnostic, _| {
match item.diag.code.as_ref() { match item.diag.code.as_ref() {
Some(NumberOrString::Number(n)) => n.to_string().into(), Some(NumberOrString::Number(n)) => n.to_string().into(),
@ -263,12 +266,12 @@ fn diag_picker(
item.diag.message.as_str().into() item.diag.message.as_str().into()
}), }),
]; ];
let mut primary_column = 2; // message let mut primary_column = 3; // message
if format == DiagnosticsFormat::ShowSourcePath { if format == DiagnosticsFormat::ShowSourcePath {
columns.insert( columns.insert(
// between message code and message // between message code and message
2, 3,
ui::PickerColumn::new("path", |item: &PickerDiagnostic, _| { ui::PickerColumn::new("path", |item: &PickerDiagnostic, _| {
if let Some(path) = item.location.uri.as_path() { if let Some(path) = item.location.uri.as_path() {
path::get_truncated_path(path) path::get_truncated_path(path)