mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-24 01:46:31 +00:00
LinearLayout: fix focus after removing child
This commit is contained in:
parent
a47537ec2c
commit
4c70b79663
@ -181,6 +181,10 @@ impl LinearLayout {
|
|||||||
pub fn remove_child(&mut self, i: usize) -> Option<Box<View>> {
|
pub fn remove_child(&mut self, i: usize) -> Option<Box<View>> {
|
||||||
if i < self.children.len() {
|
if i < self.children.len() {
|
||||||
self.invalidate();
|
self.invalidate();
|
||||||
|
|
||||||
|
if self.focus > i {
|
||||||
|
self.focus -= 1;
|
||||||
|
}
|
||||||
Some(self.children.remove(i).view)
|
Some(self.children.remove(i).view)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
Loading…
Reference in New Issue
Block a user