@@ -578,22 +578,24 @@ fn edit_int(val: &mut Integer, valid_values: &Vec<String>, stdout: &mut RawTermi
578
578
if hex_val. contains ( ' ' ) {
579
579
hex_val = hex_val. split ( " " ) . next ( ) . unwrap ( ) . trim ( ) . to_owned ( ) ;
580
580
}
581
- let dec_val = i64:: from_str_radix ( & hex_val[ 2 ..] , 16 ) . unwrap ( ) ;
582
- if dec_val & new_int == dec_val {
583
- write ! ( stdout, "\x1b [32m" ) . unwrap ( ) ;
584
- if hit_space && i == selected {
585
- new_int -= dec_val;
586
- new = new_int. to_string ( ) ;
587
- hit_space = false ;
588
- write ! ( stdout, "\x1b [31m" ) . unwrap ( ) ;
589
- }
590
- } else {
591
- write ! ( stdout, "\x1b [31m" ) . unwrap ( ) ;
592
- if hit_space && i == selected {
593
- new_int += dec_val;
594
- new = new_int. to_string ( ) ;
595
- hit_space = false ;
581
+ if hex_val. len ( ) > 2 && & hex_val[ ..2 ] == "0x" {
582
+ let dec_val = i64:: from_str_radix ( & hex_val[ 2 ..] , 16 ) . unwrap ( ) ;
583
+ if dec_val & new_int == dec_val {
596
584
write ! ( stdout, "\x1b [32m" ) . unwrap ( ) ;
585
+ if hit_space && i == selected {
586
+ new_int -= dec_val;
587
+ new = new_int. to_string ( ) ;
588
+ hit_space = false ;
589
+ write ! ( stdout, "\x1b [31m" ) . unwrap ( ) ;
590
+ }
591
+ } else {
592
+ write ! ( stdout, "\x1b [31m" ) . unwrap ( ) ;
593
+ if hit_space && i == selected {
594
+ new_int += dec_val;
595
+ new = new_int. to_string ( ) ;
596
+ hit_space = false ;
597
+ write ! ( stdout, "\x1b [32m" ) . unwrap ( ) ;
598
+ }
597
599
}
598
600
}
599
601
write ! ( stdout, "{}\x1b [0m\x1B [0K\r \n " , vals) . unwrap ( ) ;
@@ -661,7 +663,7 @@ fn edit_string(
661
663
let mut selected = valid_values. len ( ) ;
662
664
if valid_values. len ( ) > 0 {
663
665
for ( i, vals) in valid_values. iter ( ) . enumerate ( ) {
664
- if vals. contains ( & new) {
666
+ if vals. split ( "---" ) . next ( ) . unwrap ( ) . trim ( ) == & new {
665
667
selected = i;
666
668
}
667
669
}
0 commit comments