fn clear_selection(&mut self, ctx: &mut Context) -> bool {
        let mut selection = self.selection(ctx);

        if selection.is_empty() {
            return false;
        }

        let mut text = String16::from(ctx.get_widget(self.target).clone::<String>("text"));

        let (start, end) = self.selection_start_end(selection);

        for i in (start..end).rev() {
            text.remove(i);
        }

        let removed_width = self.measure(ctx, start, end).width;

        let mut offset = *Cursor::offset_ref(&ctx.get_widget(self.cursor));
        offset = (offset + removed_width).min(0.);

        Cursor::offset_set(&mut ctx.get_widget(self.cursor), offset);
        TextBlock::offset_set(&mut ctx.get_widget(self.text_block), offset);

        selection.set(start);

        self.set_text(ctx, text.to_string());
        self.set_selection(ctx, selection);

        if self.len(ctx) == 0 {
            self.update_focused_state(ctx);
        }

        true
    }
// clear all chars from the selection.
clear all chars from the selection.
clear all chars from the selection .
fn clear_selection(&mut self, ctx: &mut Context) -> bool {
        let mut selection = self.selection(ctx);
        if selection.is_empty() {
            return false;
        }
        let mut text = String16::from(ctx.get_widget(self.target).clone::<String>("text"));
        let (start, end) = self.selection_start_end(selection);
        for i in (start..end).rev() {
            text.remove(i);
        }
        let removed_width = self.measure(ctx, start, end).width;
        let mut offset = *Cursor::offset_ref(&ctx.get_widget(self.cursor));
        offset = (offset + removed_width).min(0.);
        Cursor::offset_set(&mut ctx.get_widget(self.cursor), offset);
        TextBlock::offset_set(&mut ctx.get_widget(self.text_block), offset);
        selection.set(start);
        self.set_text(ctx, text.to_string());
        self.set_selection(ctx, selection);
        if self.len(ctx) == 0 {
            self.update_focused_state(ctx);
        }
        true
    }
fn clear_selection ( & mut self , ctx : & mut Context ) -> bool { let mut selection = self . selection ( ctx ) ; if selection . is_empty ( ) { return false ; } let mut text = String16 :: from ( ctx . get_widget ( self . target ) . clone :: < String > ( " " ) ) ; let ( start , end ) = self . selection_start_end ( selection ) ; for i in ( start .. end ) . rev ( ) { text . remove ( i ) ; } let removed_width = self . measure ( ctx , start , end ) . width ; let mut offset = * Cursor :: offset_ref ( & ctx . get_widget ( self . cursor ) ) ; offset = ( offset + removed_width ) . min ( 0. ) ; Cursor :: offset_set ( & mut ctx . get_widget ( self . cursor ) , offset ) ; TextBlock :: offset_set ( & mut ctx . get_widget ( self . text_block ) , offset ) ; selection . set ( start ) ; self . set_text ( ctx , text . to_string ( ) ) ; self . set_selection ( ctx , selection ) ; if self . len ( ctx ) == 0 { self . update_focused_state ( ctx ) ; } true }
clear all chars from the selection.
clear all chars from the selection .
&mut self
ctx
&mut Context