Commit Graph

1906 Commits

Author SHA1 Message Date
NRK e60be2eaa2 silence new clang-tidy warnings 2024-04-24 07:31:15 +00:00
Martin Ziemer 28d993a8e8 Fix file creation on OpenBSD
On OpenBSD at least one of O_RDONLY, O_WRONLY or O_RDWR is needed to open a file.

In creating a new file none of those is set, which leads to an EINVAL error ("invalid argument").

Since the new file is only created and never read, I chose to use O_WRONLY.
2024-04-04 15:57:36 +02:00
Arun Prakash Jana f71b1309a9
Fix deletion prompt when rm is used 2024-02-18 06:32:49 +05:30
KlzXS 3d6777920a
Add -- to mvg and cpg which were missed 2024-02-13 18:49:02 +01:00
KlzXS b392dd3723
Added -- to all instances of cp, mv or rm dealing with user provided paths 2024-02-13 14:32:42 +01:00
90 eb3888cb09
Add option to `rm -rf` irrespective of trash setting 2024-02-09 23:14:56 +05:30
Arun Prakash Jana 94aeaccdbd
Fix #1765: detect and ignore false mouse click 2024-02-09 23:14:49 +05:30
NRK 0738f39cf0 show relative line numbering when jumping
Co-authored-by: Darukutsu <darupeter@pm.me>
Closes: https://github.com/jarun/nnn/pull/1804
Closes: https://github.com/jarun/nnn/discussions/1708
2024-02-03 09:53:11 +00:00
me 3d2caf861d Setting PWD: set on use case, not on browse
This moves setting PWD environment variable closer to the places where child process (that needs PWD correctly set) is started instead of start it on browse.
2023-12-14 11:03:38 +03:00
me ab718387c2 Set PWD environment variable
This is to make spawned shells and processes to see "logical" path.
2023-12-04 14:09:37 +03:00
Arun f2a909dafd
Merge pull request #1770 from 7ocb/pass-path-to-abspath
When handling SEL_NEW pass `path` to `abspath` call
2023-11-25 18:36:52 +05:30
me 9aaf9491ad When handling bookmark, use readlink, not realpath
This is to cd to path as it pointed by symlink, not to it's real path. Bookmarked directory may itself contain symlinks in path, which should be respected.

For example: if directory is physically in /mnt/storage/some and it's symlinked to ~/some and directory ~/some/dir added to bookmarks, it's expected that when following bookmark directory will be changed to ~/some/dir (as in bookmark's link) not to /mnt/storage/some/dir (as dir real path).
2023-11-22 20:41:49 +03:00
me bca441e00f When handling SEL_NEW pass `path` to `abspath` call
If `path` is not provided to `abspath`, later will do `getcwd`, and it's result will differ from `path`. This causes problem that when creating directory inside path reached with symlink, subsequent call to get_cwd_entry does not recognize newly created path as subpath of current path, thus not selecting newly created element.
2023-11-21 19:26:20 +03:00
NRK 60eabb6170 silence ci warning 2023-11-21 20:50:45 +06:00
NRK 3665541dac fix buffer overflow on certain platforms
the size of g_buf depends on PATH_MAX and NAME_MAX which on certain
platforms (such as mac) might not be big enough to decode the help
string. use an explicit buffer with proper size instead.

Closes: https://github.com/jarun/nnn/issues/1768
2023-11-21 19:32:00 +06:00
blissful c0b3cc8689
factor out a `setcfg` function for setting the cfg global 2023-11-18 16:34:17 -05:00
blissful 703d349389
restore sort function pointers when restoring cfg 2023-11-17 17:45:06 -05:00
NRK 4d5e29c3dd fix CI 2023-09-23 12:26:58 +06:00
NRK 6d6fc3419e split clang-tidy checks into multiple lines
makes it more readable and more easily editable. also produces better
diff when editing.
2023-09-23 12:26:29 +06:00
Arun Prakash Jana 9c7c7284c0
Option `-N` to use native prompt
This is useful for situations where the executable is compiled with
readline support but the user wants to use the native prompt. Often
this happens because packagers build without readline disabled.
2023-09-20 23:02:04 +05:30
Arun Prakash Jana 33126ee813
Prepare for release v4.9 Elixir 2023-08-27 09:55:13 +05:30
Quan Tong d220c50773 Double-width icons can cause duplicated first characters in the filename on macOS 2023-08-11 06:54:15 +07:00
Arun Prakash Jana 693ba757c0
Fix #1704 - Show only selected file name if sel is preferred 2023-08-05 23:53:01 +05:30
Arun Prakash Jana 3539e5c1b1
Update help 2023-07-28 20:52:21 +05:30
ANtlord dedf0554e5 Jump to the next young file
Forward jumping to the next young file is implemented. The starting
position from which the next young file is searched is the next
position. If no young file has been found, the search starts from the
beginning. It stops at the initial position where the search has
started.
2023-07-25 08:17:21 +06:00
NRK db8b61866b define _FILE_OFFSET_BITS 64 unconditionally
according to the manpage, it won't have any effect on 64bit system
anyways. and musl always uses 64bit so this macro doesn't have any
effect there either.
2023-07-01 08:56:18 +06:00
Arun 26d5b5c614
Merge pull request #1668 from N-R-K/better_compress
better and faster string compression
2023-06-16 12:14:02 +05:30
JingMatrix e6ce7a614e Add djvu icon
Use paperclip as icon since it is used by DjVuLibre.
2023-06-15 16:56:51 +02:00
NRK 4c2ce0a84d better helpstring compression
this avoids multiple printf calls and instead decodes the buffer
natively. using %NN instead of %-NNc also saves two bytes per run.
helpstr is also made `static` to avoid unnecessary stack allocation.
2023-06-15 08:49:30 +06:00
NRK b2b830e69d fix: properly update mode after xchmod
xchmod now returns the new mode through a pointer, no need to assume all
executable bits were toggled.

Closes: https://github.com/jarun/nnn/issues/1657
2023-05-26 19:31:00 +06:00
Arun 04d9f6738d
Merge pull request #1650 from leo-arch/master
Fix crash when PWD is set to empty string
2023-05-19 01:57:34 +05:30
Arun e013a867da
Merge pull request #1651 from N-R-K/cp_mv
make the cp/mv modification more robust
2023-05-19 01:56:53 +05:30
NRK 16899bda53 make the cp/mv modification more robust
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.
2023-05-15 11:29:47 +06:00
leo-arch 4babedc3e4
Fix crash when PWD is set to empty string
nnn crashes when PWD is set to empty string: `PWD="" nnn`
2023-05-14 20:12:04 +00:00
Jasper fb3a648756 Update Haskell icon color 2023-05-12 15:19:04 +10:00
Luuk van Baal 20e944f5e5
Update nerd-font icons to v3
This is an upstream breaking change.
Update your font to the latest version if you see missing icons.
2023-05-05 01:01:43 +02:00
Arun Prakash Jana 5d81aeb477 Filter adjustment when opening context from plugin
- 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.
2023-04-29 21:53:49 +05:30
NRK 20725b0b4d icons-hash: replace assert with handmade version
since 2fc9d51, the hash-table generator inherits environmental
CFLAGS and so we shouldn't disallow setting -DNDEBUG.

fixes: https://github.com/jarun/nnn/issues/1632
2023-04-22 17:08:00 +06:00
Arun Prakash Jana 8a1dce888a
config option to specify archive mounter utility 2023-04-14 01:47:50 +05:30
Arun Prakash Jana 6dd8cf8b4d
Happy Birthday nnn!
Prepare for release v4.8 Spritz!
2023-04-13 18:37:42 +05:30
Kian-Meng Ang 3d1bc6e8e5 Fix typos
Found via `codespell -L noice,nd,fils,numer,caf,iterm`
2023-04-03 12:49:03 +08:00
yosh 98d3b2135d add jxl icon 2023-03-28 11:44:38 -04:00
NRK 57882ffab7 add shell_escape() to properly escape filenames fed to shell
Fixes: https://github.com/jarun/nnn/issues/1615
2023-03-22 10:09:39 +06:00
NRK 003228afba add some critical comments 2023-03-05 18:43:08 +06:00
NRK 3a30211e6c handle tilde more strictly in mkpath and abspath
otherwise, if a file is named "~" it will get incorrectly expanded into
$HOME and disaster can happen.
2023-02-26 18:13:26 +06:00
NRK 8dbd9da0cc convert_tilde: return whether the conversion was done or not 2023-02-25 21:15:55 +06:00
NRK a59a91c312 handle tilde more correctly
closes: https://github.com/jarun/nnn/issues/1596
2023-02-25 21:15:46 +06:00
Arun Prakash Jana b874da395c
Update copyright year 2023-02-19 08:28:20 +05:30
NRK 9cc4b66868 export NNN_PREFER_SELECTION to all plugins 2023-02-17 19:24:45 +06:00
NRK 8ad5c87107 nmv: prefer selection if -u is active
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.
2023-02-17 19:22:46 +06:00