multi-cursor actions
This commit is contained in:
+1
-3
@@ -171,11 +171,9 @@ impl Buffer {
|
||||
}
|
||||
|
||||
pub fn combine_cursors_if_overlapping(&mut self) {
|
||||
if self.cursors.is_empty() { return; }
|
||||
|
||||
let mut index = 0;
|
||||
|
||||
while index < self.cursors.len() - 1 {
|
||||
while !self.cursors.is_empty() && index < self.cursors.len() - 1 {
|
||||
while index < self.cursors.len() - 1 &&
|
||||
self.cursors[index].range().is_overlapping(
|
||||
&self.cursors[index + 1].range())
|
||||
|
||||
+19
-12
@@ -221,18 +221,25 @@ mod hex {
|
||||
|
||||
let span = SPAN_FOR_BYTE[byte as usize].clone();
|
||||
|
||||
let head_color = match self.mode {
|
||||
Mode::Select => Color::Yellow,
|
||||
_ => Color::Gray
|
||||
};
|
||||
|
||||
match iter::once(&self.primary_cursor)
|
||||
.chain(&self.cursors)
|
||||
.find_map(|cursor| cursor.contains(address))
|
||||
{
|
||||
Some(InCursor::Head) => span.bg(head_color),
|
||||
Some(InCursor::Rest) => span.bg(Color::select_grey()),
|
||||
None => span,
|
||||
if let Some(place_in_cursor) = self.primary_cursor.contains(address) {
|
||||
let head_color = match self.mode {
|
||||
Mode::Select => Color::Yellow,
|
||||
_ => Color::Gray
|
||||
};
|
||||
|
||||
match place_in_cursor {
|
||||
InCursor::Head => span.bg(head_color),
|
||||
InCursor::Rest => span.bg(Color::select_grey()),
|
||||
}
|
||||
} else {
|
||||
match self.cursors
|
||||
.iter()
|
||||
.find_map(|cursor| cursor.contains(address))
|
||||
{
|
||||
Some(InCursor::Head) => span.on_gray(),
|
||||
Some(InCursor::Rest) => span.bg(Color::select_grey()),
|
||||
None => span,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user