diff options
author | Skorpionm <85568270+Skorpionm@users.noreply.github.com> | 2021-12-01 18:44:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-01 18:44:39 +0300 |
commit | b912cc79914b74f256cd641b610001cdb8072a2f (patch) | |
tree | c5912dc088e2a6d7889a432f1726418997fc982b /applications/cli | |
parent | 54c41e4189c662c65c3e0a50086e73dc532c9165 (diff) |
SubGhz: sending / receiving messages via subghz (#851)
* SubGhz: add worker subghz_txrx
* SubGhz: added support for transferring Russian characters and support for backspace in CLI subghz_txrx
* SubGhz: refactoring subghz_txrx_worker, added a callback for accepting data in an empty one RX buffer
* SubGhz: fix conflict
* SubGhz: fix syntax errors
* Cli: document string_move usage and its behavior
* FuriHal: update subghz api and documentation. Subghz: move chat to subghz cli subcommand.
* Subghz: update text in chat cli
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
Diffstat (limited to 'applications/cli')
-rw-r--r-- | applications/cli/cli.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/applications/cli/cli.c b/applications/cli/cli.c index 7d60f7d1..fe449906 100644 --- a/applications/cli/cli.c +++ b/applications/cli/cli.c @@ -113,7 +113,9 @@ void cli_prompt(Cli* cli) { } void cli_reset(Cli* cli) { + // cli->last_line is cleared and cli->line's buffer moved to cli->last_line string_move(cli->last_line, cli->line); + // Reiniting cli->line string_init(cli->line); cli->cursor_position = 0; } @@ -129,7 +131,11 @@ static void cli_handle_backspace(Cli* cli) { string_reserve(temp, string_size(cli->line) - 1); string_set_strn(temp, string_get_cstr(cli->line), cli->cursor_position - 1); string_cat_str(temp, string_get_cstr(cli->line) + cli->cursor_position); + + // cli->line is cleared and temp's buffer moved to cli->line string_move(cli->line, temp); + // NO MEMORY LEAK, STOP REPORTING IT + cli->cursor_position--; } else { cli_putc(CliSymbolAsciiBell); @@ -332,7 +338,11 @@ void cli_process_input(Cli* cli) { string_set_strn(temp, string_get_cstr(cli->line), cli->cursor_position); string_push_back(temp, c); string_cat_str(temp, string_get_cstr(cli->line) + cli->cursor_position); + + // cli->line is cleared and temp's buffer moved to cli->line string_move(cli->line, temp); + // NO MEMORY LEAK, STOP REPORTING IT + // Print character in replace mode printf("\e[4h%c\e[4l", c); fflush(stdout); |