Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | Extend the "don't overwrite fields if only carriage return is entered" to password field
And also use malloc. What I'd done before wasn't doing what I thought. C I'm in two minds about the benefit of dynamic allocation though. Since |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/tweaks | trunk |
Files: | files | file ages | folders |
SHA3-256: |
378769ec4367269d3ca376640adf8965 |
User & Date: | atomicules@lavabit.com 2013-03-23 21:27:08 |
2014-01-03
| ||
22:31 | Merge branch 'modernise' into tweaks check-in: 229ff25e0f user: base@atomicules.co.uk tags: origin/tweaks, trunk | |
22:25 | WIP on tweaks: 98593a8 Extend the "don't overwrite fields if only carriage return is entered" to password field Leaf check-in: 4a8cb3e9a0 user: base@atomicules.co.uk tags: refs/stash, trunk | |
22:25 | index on tweaks: 98593a8 Extend the "don't overwrite fields if only carriage return is entered" to password field check-in: db8bd43770 user: base@atomicules.co.uk tags: refs/stash, trunk | |
2013-03-23
| ||
21:27 |
Extend the "don't overwrite fields if only carriage return is entered" to password field
And also use malloc. What I'd done before wasn't doing what I thought. C I'm in two minds about the benefit of dynamic allocation though. Since | |
2013-03-22
| ||
17:02 |
Don't overwrite fields if only carriage return is entered
In other words, prevent accidentally deleting fields. This has always This small change means that if you just enter return then the old value This is good enough for me. There is one downside: if you really want to | |
Changes to src/ui.c.
︙ | ︙ | |||
458 459 460 461 462 463 464 | char * ui_statusline_ask_str(char *msg, char *input, int len) { char *tmp; char *tmp2; char *tmp3; | | > | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | char * ui_statusline_ask_str(char *msg, char *input, int len) { char *tmp; char *tmp2; char *tmp3; char *oldinput; int x = strlen(msg) + 5; oldinput = malloc(strlen(input)+1); //Back-up the old value strcpy(oldinput, input); if(input == NULL){ input = malloc(len); } ui_statusline_clear(); |
︙ | ︙ | |||
521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | *tmp2 = 0; } else { tmp++; } } // All done return input; } char * ui_statusline_ask_str_with_autogen(char *msg, char *input, int len, char *(*autogen)(char *), int ch) { int i = 0; int c; char *text[2], *s; int x; if(input == NULL){ input = malloc(len); } text[0] = malloc(STRING_MEDIUM); text[1] = malloc(STRING_SHORT); | > > > > > > | 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 | *tmp2 = 0; } else { tmp++; } } // All done free(oldinput); return input; } char * ui_statusline_ask_str_with_autogen(char *msg, char *input, int len, char *(*autogen)(char *), int ch) { int i = 0; int c; char *text[2], *s; char *oldinput; int x; oldinput = malloc(strlen(input)+1); //Back-up the old value strcpy(oldinput, input); if(input == NULL){ input = malloc(len); } text[0] = malloc(STRING_MEDIUM); text[1] = malloc(STRING_SHORT); |
︙ | ︙ | |||
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | i++; } } hide_cursor(); ui_statusline_clear(); free(text[0]); free(text[1]); return input; } char * ui_statusline_ask_passwd(char *msg, char *input, int len, int cancel) { | > > > > > > | 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 | i++; } } hide_cursor(); ui_statusline_clear(); //If just return entered, don't overwrite old value if(strlen(input) == 0){ strcpy(input, oldinput); } free(text[0]); free(text[1]); free(oldinput); return input; } char * ui_statusline_ask_passwd(char *msg, char *input, int len, int cancel) { |
︙ | ︙ |