Fix more width issues

This commit is contained in:
Dheepak Krishnamurthy 2021-05-06 09:42:44 -06:00
parent a74d101b39
commit e20ec465c6
3 changed files with 14 additions and 15 deletions

View file

@ -17,6 +17,7 @@ use rustyline_derive::Helper;
use unicode_segmentation::Graphemes;
use unicode_segmentation::UnicodeSegmentation;
use unicode_width::UnicodeWidthStr;
pub fn get_start_word_under_cursor(line: &str, cursor_pos: usize) -> usize {
let mut chars = line[..cursor_pos].chars();
@ -143,10 +144,7 @@ impl CompletionList {
}
pub fn max_width(&self) -> Option<usize> {
self.candidates()
.iter()
.map(|p| p.display.graphemes(true).count() + 4)
.max()
self.candidates().iter().map(|p| p.display.width() + 4).max()
}
pub fn get(&self, i: usize) -> Option<String> {