this makes it so that if the cp/mv commands are changed the in the
future, it will continue to work reliably instead of having hardcoded
indexes to modify the array.
the `#ifdef __linux__` is also removed, compilers should be smart enough
to see that PROGRESS_{CP,MV} are unused (on non-linux systems) and
optimize it out.
- Clear filter only when a plugin is selected manually.
Plugin dir should be unfiltered when opened.
- Plugins invoked by keys don't require clearing filter
of original context. If a new context is opened using
the plugin, it will be unfiltered by default. If the
same context is re-used (when all the contexts are in
use) the filter should be cleared so the the new path
is opened unfiltered.
the rename plugin always asks for "selection vs current" even when -u
flag is active. pass it to the plugin via `NNN_PREFER_SELECTION` so that
there's less distracting prompts.
1. hover on entry created in cwd
2. check user input doesn't end with /
3. check user input len < PATH_MAX
4. support creation in ~ directory
5. handle filter mode after creation
6. ensure absolute path len < PATH_MAX
nnn source code already uses C11, which introduced `_Alignas` [^0] as a
standardized alternative to __attribute__((aligned)).
there are no other usage of `__attribute__` in the nnn source code, so
in theory this should make things more portable across compilers.
also removes an unnecessary usage of `alloca()` with an aligned constant
sized buffer instead.
[^0]: https://en.cppreference.com/w/c/language/_Alignas
Found memory deallocation edge case
Update and move chunk limit check
Generalize maximum size of input
Remove hard-coded values
Remove superfluous check before free
Let the kernel deal with extra data
Handle signals while reading
Conform to the manpage
Make CI happy
use `size_t` instead of `ssize_t`
`ssize_t` was used just so `--i` when `i` was zero would become -1
instead of SIZE_MAX. for looping through something in reverse order, the
"goes-to" operator (`-->`) can be used instead which doesn't require `i`
to be signed anymore.
remove useless blank line
use a normal loop
don't see any reason why freeing in reverse order would've been needed.
Co-authored-by: N-R-K <nrk@disroot.org>
- support listing maximum 16K files
- check if target directory exists before directory tree creation
in most of the cases many files will be under the same directory
- make frequently used function 'inline'
a lot of the extension use the same icon. this can be exploited via
having an array with all the unique icons and then storing a single byte
index into the unique array.
when using `O_EMOJI` this results in around ~1.7KiB drop in the total
table size. `O_NERD` and `O_ICONS` get roughly ~0.5KiB savings.
This pretty much reworks the entire icon system. Some notable changes:
* The extensions are put into a statically generated hash-table instead
of a sorted array. We use Robin-Hood insertion to reduce the max probe
length. Currently we need to probe only 2 slots for `O_EMOJI` and only
3 for `O_NERD`/`O_ICONS`.
* I've opted not to use a perfect-hash since the perfect hashes
generated by [`gperf`](https://www.gnu.org/software/gperf) used some
huge lookup table. The hash function also wasn't as minimal as I'd
like.
* Colors are now using X-Macros. This should speed up startup since we
don't have to search `icons_ext` linearly to find unique colors.
* The hash-table generator outputs a more space optimized `struct
icon_pair` using a char array instead of char pointer. This brings
down the binary size from `145KiB` when using `O_NERD` down to
`137KiB`.
* Some unnecessary duplication and indirection has been reduced by using
the `ICON_STR()` macro.
reduces some unncessary code. and when initializing larger objects,
compilers (gcc and clang at least) typically tend to compile it down to
a memset anyways.
anything not explicitly initialized will be implicitly initialized to
zero. this makes things more robust since comments are not checked by
the compiler and can be incorrect.
Reasons:
1. `b` is not a special key and will be interpreted as a filter
2. with this change pressing the standard `-` inside a symlinked
bookmark takes back to the bookmarks directory. This deviates
from the regular bookmarks behaviour.