esc and entr handling in command mode
This commit is contained in:
parent
5daf8b9dd3
commit
5eb4437ac4
6 changed files with 66 additions and 14 deletions
37
kubo_char_arr.h
Normal file
37
kubo_char_arr.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright Luka Jankovic 2025
|
||||
*
|
||||
* This file is part of Kubo.
|
||||
*
|
||||
* Kubo is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* Kubo is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* Kubo. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef KUBO_CHAR_ARR_H
|
||||
#define KUBO_CHAR_ARR_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "kubo_dynarray.h"
|
||||
|
||||
KUBO_DYNARRAY_REGISTER(kubo_char_arr, char);
|
||||
|
||||
static inline char *kubo_char_arr_build_str(struct kubo_char_arr *arr) {
|
||||
char *res = malloc(arr->count + 1);
|
||||
for (int i = 0; i < arr->count; i++) {
|
||||
res[i] = kubo_char_arr_get(arr, i);
|
||||
}
|
||||
res[arr->count] = '\0';
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue