From f2f2aff784586ed9b9424d1815b59419a1a8ba14 Mon Sep 17 00:00:00 2001 From: Evgeniy Tatarkin Date: Mon, 7 Nov 2022 09:17:44 +0300 Subject: [PATCH] rename used_at to focused_at, use sort_unstable_by_key --- helix-term/src/commands.rs | 4 ++-- helix-view/src/document.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 77fbc536fed6..febdcf463ede 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -2342,7 +2342,7 @@ fn buffer_picker(cx: &mut Context) { path: doc.path().cloned(), is_modified: doc.is_modified(), is_current: doc.id() == current, - used_at: doc.used_at, + used_at: doc.focused_at, }; let mut items = cx @@ -2350,7 +2350,7 @@ fn buffer_picker(cx: &mut Context) { .documents .values() .map(|doc| new_meta(doc)) - .collect(); + .collect::>(); // mru items.sort_by(|a, b| b.used_at.cmp(&a.used_at)); diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 0d5b53363c68..449a1a2b7d5b 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -140,7 +140,7 @@ pub struct Document { diff_handle: Option, // when document was used for most-recent-used buffer picker - pub used_at: std::time::Instant, + pub focused_at: std::time::Instant, } use std::{fmt, mem}; @@ -380,7 +380,7 @@ impl Document { modified_since_accessed: false, language_server: None, diff_handle: None, - used_at: std::time::Instant::now(), + focused_at: std::time::Instant::now(), } } @@ -774,7 +774,7 @@ impl Document { /// Mark document as recent used for MRU sorting pub fn mark_as_used(&mut self) { - self.used_at = std::time::Instant::now(); + self.focused_at = std::time::Instant::now(); } /// Remove a view's selection from this document.