@@ -1588,89 +1588,90 @@ impl<'array> ArrayTable<'array> {
1588
1588
if i. consume_shortcut ( & SHORTCUT_REPLACE ) {
1589
1589
self . open_replace_panel ( None ) ;
1590
1590
}
1591
- let hovered_cell = array_response. hover_data . hovered_cell ;
1592
- for event in i. events . iter ( ) . filter ( |e| match e {
1593
- egui:: Event :: Copy => hovered_cell. is_some ( ) ,
1594
- egui:: Event :: Paste ( _) => hovered_cell. is_some ( ) ,
1591
+
1592
+ }
1593
+ let hovered_cell = array_response. hover_data . hovered_cell ;
1594
+ for event in i. events . iter ( ) . filter ( |e| match e {
1595
+ egui:: Event :: Copy => hovered_cell. is_some ( ) ,
1596
+ egui:: Event :: Paste ( _) => hovered_cell. is_some ( ) ,
1597
+ egui:: Event :: Key {
1598
+ key : Key :: Delete , ..
1599
+ } => hovered_cell. is_some ( ) ,
1600
+ _ => false ,
1601
+ } ) {
1602
+ let cell_location = hovered_cell. unwrap ( ) ;
1603
+ let row_index = self . filtered_nodes [ cell_location. row_index ] ;
1604
+ let index = self . get_pointer_index_from_cache (
1605
+ cell_location. is_pinned_column_table ,
1606
+ & & self . nodes [ row_index] ,
1607
+ cell_location. column_index ,
1608
+ ) ;
1609
+
1610
+ match event {
1595
1611
egui:: Event :: Key {
1596
1612
key : Key :: Delete , ..
1597
- } => hovered_cell. is_some ( ) ,
1598
- _ => false ,
1599
- } ) {
1600
- let cell_location = hovered_cell. unwrap ( ) ;
1601
- let row_index = self . filtered_nodes [ cell_location. row_index ] ;
1602
- let index = self . get_pointer_index_from_cache (
1603
- cell_location. is_pinned_column_table ,
1604
- & & self . nodes [ row_index] ,
1605
- cell_location. column_index ,
1606
- ) ;
1607
-
1608
- match event {
1609
- egui:: Event :: Key {
1610
- key : Key :: Delete , ..
1611
- } => {
1612
- let columns = self . columns ( cell_location. is_pinned_column_table ) ;
1613
- let pointer = Self :: pointer_key (
1614
- & self . parent_pointer . pointer ,
1615
- row_index,
1616
- columns
1617
- . get ( cell_location. column_index )
1618
- . as_ref ( )
1619
- . unwrap ( )
1620
- . name
1621
- . as_str ( ) ,
1622
- ) ;
1623
- let flat_json_value = FlatJsonValue :: < String > {
1624
- pointer : PointerKey {
1625
- pointer,
1626
- value_type : columns[ cell_location. column_index ] . value_type ,
1627
- depth : columns[ cell_location. column_index ] . depth ,
1628
- position : 0 ,
1629
- column_id : columns[ cell_location. column_index ] . id ,
1630
- } ,
1631
- value : None ,
1632
- } ;
1633
- self . update_value ( flat_json_value, row_index, !self . is_sub_table ) ;
1634
- }
1635
- egui:: Event :: Paste ( v) => {
1636
- let columns = self . columns ( cell_location. is_pinned_column_table ) ;
1637
- let pointer = Self :: pointer_key (
1638
- & self . parent_pointer . pointer ,
1639
- row_index,
1640
- & columns
1641
- . get ( cell_location. column_index )
1642
- . as_ref ( )
1643
- . unwrap ( )
1644
- . name ,
1645
- ) ;
1646
- let mut flat_json_value = FlatJsonValue :: < String > {
1647
- pointer : PointerKey {
1648
- pointer,
1649
- value_type : columns[ cell_location. column_index ] . value_type ,
1650
- depth : columns[ cell_location. column_index ] . depth ,
1651
- position : 0 ,
1652
- column_id : columns[ cell_location. column_index ] . id ,
1653
- } ,
1654
- value : Some ( v. clone ( ) ) ,
1655
- } ;
1656
- match flat_json_value. pointer . value_type {
1657
- // When we paste an object it should not be considered as parsed
1658
- ValueType :: Object ( ..) => {
1659
- flat_json_value. pointer . value_type = ValueType :: Object ( false , 0 )
1660
- }
1661
- _ => { }
1613
+ } => {
1614
+ let columns = self . columns ( cell_location. is_pinned_column_table ) ;
1615
+ let pointer = Self :: pointer_key (
1616
+ & self . parent_pointer . pointer ,
1617
+ row_index,
1618
+ columns
1619
+ . get ( cell_location. column_index )
1620
+ . as_ref ( )
1621
+ . unwrap ( )
1622
+ . name
1623
+ . as_str ( ) ,
1624
+ ) ;
1625
+ let flat_json_value = FlatJsonValue :: < String > {
1626
+ pointer : PointerKey {
1627
+ pointer,
1628
+ value_type : columns[ cell_location. column_index ] . value_type ,
1629
+ depth : columns[ cell_location. column_index ] . depth ,
1630
+ position : 0 ,
1631
+ column_id : columns[ cell_location. column_index ] . id ,
1632
+ } ,
1633
+ value : None ,
1634
+ } ;
1635
+ self . update_value ( flat_json_value, row_index, !self . is_sub_table ) ;
1636
+ }
1637
+ egui:: Event :: Paste ( v) => {
1638
+ let columns = self . columns ( cell_location. is_pinned_column_table ) ;
1639
+ let pointer = Self :: pointer_key (
1640
+ & self . parent_pointer . pointer ,
1641
+ row_index,
1642
+ & columns
1643
+ . get ( cell_location. column_index )
1644
+ . as_ref ( )
1645
+ . unwrap ( )
1646
+ . name ,
1647
+ ) ;
1648
+ let mut flat_json_value = FlatJsonValue :: < String > {
1649
+ pointer : PointerKey {
1650
+ pointer,
1651
+ value_type : columns[ cell_location. column_index ] . value_type ,
1652
+ depth : columns[ cell_location. column_index ] . depth ,
1653
+ position : 0 ,
1654
+ column_id : columns[ cell_location. column_index ] . id ,
1655
+ } ,
1656
+ value : Some ( v. clone ( ) ) ,
1657
+ } ;
1658
+ match flat_json_value. pointer . value_type {
1659
+ // When we paste an object it should not be considered as parsed
1660
+ ValueType :: Object ( ..) => {
1661
+ flat_json_value. pointer . value_type = ValueType :: Object ( false , 0 )
1662
1662
}
1663
- self . edit_cell ( array_response , flat_json_value , row_index ) ;
1663
+ _ => { }
1664
1664
}
1665
- egui:: Event :: Copy => {
1666
- if let Some ( index) = index {
1667
- if let Some ( value) = & self . nodes [ row_index] . entries ( ) [ index] . value {
1668
- copied_value = Some ( value. clone ( ) ) ;
1669
- }
1665
+ self . edit_cell ( array_response, flat_json_value, row_index) ;
1666
+ }
1667
+ egui:: Event :: Copy => {
1668
+ if let Some ( index) = index {
1669
+ if let Some ( value) = & self . nodes [ row_index] . entries ( ) [ index] . value {
1670
+ copied_value = Some ( value. clone ( ) ) ;
1670
1671
}
1671
1672
}
1672
- _ => { }
1673
1673
}
1674
+ _ => { }
1674
1675
}
1675
1676
}
1676
1677
} ) ;
@@ -1681,22 +1682,30 @@ impl<'array> ArrayTable<'array> {
1681
1682
1682
1683
pub fn get_typed_alphanum_from_events ( i : & mut InputState ) -> Option < String > {
1683
1684
let mut typed_alphanum: Option < String > = None ;
1684
- i. events . iter ( ) . any ( |e| match e {
1685
- egui:: Event :: Key { key, modifiers, .. } if matches ! (
1685
+ i. events . retain ( |e| {
1686
+ match e {
1687
+ egui:: Event :: Key { key, modifiers, .. } if matches ! (
1686
1688
key,
1687
1689
Key :: A | Key :: B | Key :: C | Key :: D | Key :: E | Key :: F | Key :: G | Key :: H
1688
1690
| Key :: I | Key :: J | Key :: K | Key :: L | Key :: M | Key :: N | Key :: O | Key :: P | Key :: Q | Key :: R | Key :: S
1689
1691
| Key :: T | Key :: U | Key :: V | Key :: W | Key :: X | Key :: Y | Key :: Z
1690
1692
| Key :: Num0 | Key :: Num1 | Key :: Num2 | Key :: Num3 | Key :: Num4 | Key :: Num5 | Key :: Num6 | Key :: Num7 | Key :: Num8 | Key :: Num9
1691
1693
) => {
1692
- let mut typed_char = key. name ( ) . to_string ( ) ;
1693
- if !matches ! ( modifiers, & Modifiers :: SHIFT ) {
1694
- typed_char = typed_char. to_lowercase ( ) ;
1695
- }
1696
- typed_alphanum = Some ( typed_char) ;
1697
- true
1698
- } ,
1699
- _ => false
1694
+
1695
+ if modifiers. ctrl || modifiers. command || modifiers. alt || modifiers. mac_cmd {
1696
+ typed_alphanum = None ;
1697
+ return true ;
1698
+ } else {
1699
+ let mut typed_char = key. name ( ) . to_string ( ) ;
1700
+ if !matches ! ( modifiers, & Modifiers :: SHIFT ) {
1701
+ typed_char = typed_char. to_lowercase ( ) ;
1702
+ }
1703
+ typed_alphanum = Some ( typed_char) ;
1704
+ }
1705
+ false
1706
+ } ,
1707
+ _ => true
1708
+ }
1700
1709
} ) ;
1701
1710
typed_alphanum
1702
1711
}
0 commit comments