diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 3840fc71f..d1c8fdee8 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -2679,13 +2679,21 @@ fn local_search(cx: &mut Context) { let columns = [ PickerColumn::new("path", |item: &FileResult, config: &LocalSearchConfig| { - Cell::from(Spans::from( - // only show line numbers in the left picker column - vec![Span::styled( - (item.line_num + 1).to_string(), - config.number_style, - )], - )) + let line_num = (item.line_num + 1).to_string(); + // files can never contain more than 999_999_999_999 lines + // thus using maximum line length to be 12 for this formatter is valid + let max_line_num_length = 12; + // whitespace padding to align results after the line number + let padding_length = max_line_num_length - line_num.len(); + let padding = " ".repeat(padding_length); + // extract line content from the editor + let line_content = ""; + // create column value to be displayed in the picker + Cell::from(Spans::from(vec![ + Span::styled(line_num, config.number_style), + Span::raw(padding), + Span::raw(line_content), + ])) }), PickerColumn::hidden("contents"), ];