Return last excerpt in MultiBuffer::excerpt_containing if overshooting
This commit is contained in:
parent
6e37ff880f
commit
b3c7526fb5
1 changed files with 15 additions and 12 deletions
|
@ -1082,7 +1082,10 @@ impl MultiBuffer {
|
|||
|
||||
let mut cursor = snapshot.excerpts.cursor::<usize>();
|
||||
cursor.seek(&position, Bias::Right, &());
|
||||
cursor.item().map(|excerpt| {
|
||||
cursor
|
||||
.item()
|
||||
.or_else(|| snapshot.excerpts.last())
|
||||
.map(|excerpt| {
|
||||
(
|
||||
excerpt.id.clone(),
|
||||
self.buffers
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue