@@ -235,9 +235,11 @@ void Edit_insert_digit(char new)
235
235
furi_string_set_n (ns , fs , 0 , len );
236
236
furi_string_cat_printf (ns , "%c" , new );
237
237
furi_string_cat_str (ns , Edit_pos );
238
- furi_string_free (fs );
239
238
Log [view_Batch ] = ns ;
240
- Edit_pos = (char * )furi_string_get_cstr (ns ) + len ;
239
+ Edit_pos = (char * )furi_string_get_cstr (ns );
240
+ Edit_start = Edit_pos + (Edit_start - (char * )furi_string_get_cstr (fs ));
241
+ Edit_pos += len ;
242
+ furi_string_free (fs );
241
243
}
242
244
}
243
245
}
@@ -1316,16 +1318,21 @@ int32_t nrf24batch_app(void* p) {
1316
1318
if (event .input .type == InputTypeShort || event .input .type == InputTypeRepeat ) {
1317
1319
if (!ask_question ) {
1318
1320
if (Edit ) {
1319
- if (* Edit_pos != '-' ) {
1320
- if (* Edit_pos < '9' ) (* Edit_pos )++ ;
1321
- else if (Edit_hex ) {
1322
- if (* Edit_pos == '9' ) * Edit_pos = 'A' ;
1323
- else if ((* Edit_pos & ~0x20 ) < 'F' ) (* Edit_pos )++ ;
1324
- } else if (Edit_pos > Edit_start && * (Edit_pos - 1 ) < '9' && * (Edit_pos - 1 ) >= '0' ) {
1325
- * Edit_pos = '0' ;
1326
- (* (Edit_pos - 1 ))++ ;
1321
+ char c = * Edit_pos ;
1322
+ if (Edit_hex ) {
1323
+ if (c == '9' ) * Edit_pos = 'A' ;
1324
+ else if (c < 'F' || c < '9' ) * Edit_pos = c + 1 ;
1325
+ } else {
1326
+ if (c == '-' ) * Edit_pos = '0' ;
1327
+ else if (c < '9' ) * Edit_pos = c + 1 ;
1328
+ else {
1329
+ c = * (Edit_pos - 1 );
1330
+ if (Edit_pos > Edit_start && c < '9' && c >= '0' ) {
1331
+ * Edit_pos = '0' ;
1332
+ (* (Edit_pos - 1 )) = c + 1 ;
1333
+ }
1327
1334
}
1328
- }
1335
+ }
1329
1336
} else if (what_doing == 0 ) {
1330
1337
if (addr_len ) {
1331
1338
if (setup_cursor > 0 ) setup_cursor -- ; else setup_cursor = 2 ;
@@ -1343,17 +1350,15 @@ int32_t nrf24batch_app(void* p) {
1343
1350
if (!ask_question ) {
1344
1351
if (Edit ) {
1345
1352
if (* Edit_pos != '-' ) {
1346
- if (Edit_hex && ( * Edit_pos & ~ 0x20 ) == 'A' ) (* Edit_pos ) = '9' ;
1353
+ if (Edit_hex && * Edit_pos == 'A' ) (* Edit_pos ) = '9' ;
1347
1354
else if (* Edit_pos > '0' ) (* Edit_pos )-- ;
1348
1355
else if (!Edit_hex ) {
1349
1356
if (Edit_pos > Edit_start ) {
1350
- if (* (Edit_pos - 1 ) > '0' ) {
1357
+ if (* (Edit_pos - 1 ) > '0' && * ( Edit_pos - 1 ) <= '9' ) {
1351
1358
* Edit_pos = '9' ;
1352
1359
(* (Edit_pos - 1 ))-- ;
1353
1360
}
1354
- } else if (strlen (Edit_start ) == 1 ) { // negative
1355
- Edit_insert_digit ('-' );
1356
- }
1361
+ } else Edit_insert_digit ('-' ); // negative
1357
1362
}
1358
1363
}
1359
1364
} else if (what_doing == 0 ) {
0 commit comments