diff options
| author | 2025-01-24 18:14:52 -0500 | |
|---|---|---|
| committer | 2025-01-24 18:14:52 -0500 | |
| commit | f638237a6b4f3d3edf9bdd995c15df537f8d7e7c (patch) | |
| tree | 44efce6d912c43f67548690256879d036e22e742 /src/fruits/cmc | |
| parent | 2daa31c0629f2eb4af84d6f4fed8ac89813de056 (diff) | |
| download | camu-f638237a6b4f3d3edf9bdd995c15df537f8d7e7c.tar.gz camu-f638237a6b4f3d3edf9bdd995c15df537f8d7e7c.tar.bz2 camu-f638237a6b4f3d3edf9bdd995c15df537f8d7e7c.zip | |
Fix multiple bugs encountered during stress test
- Basic server resource cleanup
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/fruits/cmc')
| -rw-r--r-- | src/fruits/cmc/ui/pane_search.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/fruits/cmc/ui/pane_search.c b/src/fruits/cmc/ui/pane_search.c index 021c42f..c1b47ed 100644 --- a/src/fruits/cmc/ui/pane_search.c +++ b/src/fruits/cmc/ui/pane_search.c @@ -40,7 +40,7 @@ static bool handle_text_input(struct cmc_search_tab *tab, struct ncinput *input) switch (input->id) { case NCKEY_BACKSPACE: if (tab->cursor > 0) { - al_wstr_remove_at(&tab->input_text, tab->cursor); + al_wstr_remove_at(&tab->input_text, tab->cursor - 1); tab->cursor--; tab->input_changed = true; } @@ -79,19 +79,36 @@ static bool handle_text_input(struct cmc_search_tab *tab, struct ncinput *input) tab->cursor++; } break; + case 'U': + for (u32 i = 1; i <= tab->cursor; i++) { + al_wstr_remove_at(&tab->input_text, tab->cursor - i); + } + tab->cursor = 0; + tab->input_changed = true; + break; } break; } + + if (ncinput_alt_p(input) || nckey_synthesized_p(input->id)) { + break; + } + + al_wstr_insert(&tab->input_text, tab->cursor, &al_wstr_w((wchar_t *)input->eff_text, 0, 1)); + tab->cursor++; + tab->input_changed = true; + + /* // https://github.com/dankamongmen/notcurses/blob/c11efe877f2245901f5c9ce110de7a2c83cfa2ed/src/lib/reader.c#L404 for (s32 c = 0; input->eff_text[c] != 0; c++){ uchar egc[5] = { 0 }; if (notcurses_ucs32_to_utf8(&input->eff_text[c], 1, egc, 4) >= 0) { // This probably doesn't work on Windows. al_wstr_insert(&tab->input_text, tab->cursor, &al_wstr_w((wchar_t *)egc, 0, 1)); - tab->cursor++; - tab->input_changed = true; } } + */ + break; } return false; |