~vpzom/savg

15be428ccff8276596799ed28e777566e35dc7eb — Colin Reeder 5 years ago 71cf0b3
Clear selection on delete
1 files changed, 8 insertions(+), 1 deletions(-)

M src/main.rs
M src/main.rs => src/main.rs +8 -1
@@ 185,6 185,8 @@ fn main() {
                let mut selection = instance.selection.write().unwrap();
                let selection: &mut Option<_> = &mut selection;

                let mut removed = false;

                if let Some(selected) = selection {
                    let mut document = instance.document.write().unwrap();
                    


@@ 192,9 194,14 @@ fn main() {

                    if let Some(pos) = pos {
                        document.content.remove(pos);
                        instance.queue_repaint();
                        removed = true;
                    }
                }

                if removed {
                    *selection = None;
                    instance.queue_repaint();
                }
            }

            Inhibit(true)