Commit graph

592 commits

Author SHA1 Message Date
Yorhel
0fc14173f2 Fix panic when shortening strings with unicode variation selectors
Fixes #199.
That's not to say it handles variation selectors or combining marks
well, though. This is kind of messy. :(
2022-04-16 20:05:43 +02:00
Yorhel
2e4f0f0bce Version 2.1.1 2022-03-25 12:38:47 +01:00
Yorhel
5f383966a9 Fix bad assertion in scan.zig:addSpecial()
While it's true that the root item can't be a special, the first item to
be added is not necessarily the root item. In particular, it isn't when
refreshing.

Probably fixes #194
2022-03-24 07:32:55 +01:00
Yorhel
3942722eba Revert default --graph-style to "hash"
Because, even in 2022, there are systems where the libc locale is not,
in fact, UTF-8. Fixes #186.
2022-03-16 09:53:02 +01:00
Yorhel
1a3de55e68 Still accept "eigth-block" typo argument for compat 2022-03-14 15:58:41 +01:00
Phil Jones
1f46dacf12 Fix typo in --graph-style option
Change "eigth-block" to "eighth-block"
2022-03-14 13:31:01 +00:00
Yorhel
35dd631e55 Version 2.1; remove 1.x changes from the ChangeLog 2022-02-07 13:59:22 +01:00
Yorhel
f79ae654f3 Fix compilation on 32bit systems
Broken in 7d2905952d
2022-02-07 13:59:22 +01:00
Yorhel
e42db579a0 scan: Add UI message when counting hard links
That *usually* doesn't take longer than a few milliseconds, but it can
take a few seconds for some extremely large dirs, on very slow computers
or with optimizations disabled. Better display a message than make it
seem as if ncdu has stopped doing anything.
2022-02-05 09:19:15 +01:00
Yorhel
7d2905952d Add --graph-style option and Unicode graph drawing
And also adjust the graph width calculation to do a better job when the
largest item is smaller than the number of columns used for the graph,
which would previously draw either nothing (if size = 0) or a full bar
(if size > 0).

Fixes #172.
2022-02-03 16:10:18 +01:00
Yorhel
edf48f6f11 Use natsort when sorting by name
Fixes #181, now also for Zig.
2022-02-03 10:59:44 +01:00
Yorhel
41f7ecafcb Mention --ignore-config flag when reading config fails 2022-02-02 12:32:41 +01:00
Yorhel
f46c7ec65d Ignore ENOTDIR when trying to open config files 2022-02-02 11:49:04 +01:00
Yorhel
1b918a5a74 browser: Fix long file name overflow + unique size display glitch 2022-02-02 10:30:36 +01:00
Yorhel
01f1e9188a Version 2.0.1 + copyright year bump 2022-01-01 16:01:47 +01:00
Yorhel
ba26e6621b Makefile: Add ZIG_FLAGS variable
Fixes #185
2022-01-01 15:49:50 +01:00
Yorhel
2b23951e4f ui.zig: Really fix import of wcwidth() this time
Fixes #183
2021-12-26 11:02:42 +01:00
Yorhel
a6f5678088 ui.zig: Fix typo in setting _XOPEN_SOURCE feature test macro 2021-12-21 15:20:07 +01:00
Yorhel
23c59f2874 Version 2.0
I'm tagging this as a "stable" 2.0 release because the 2.0-beta#
numbering will get confusing when I'm working on new features and fixes.
It's still only usable for people who can use the particular Zig version
that's required (0.9.0 currently) and it will certainly break on
different Zig versions. But once you have a working binary for a
supported arch, it's perfectly stable.
2021-12-21 10:56:51 +01:00
Yorhel
6a68cd9b89 Fixes and updates for Zig 0.9.0 2021-12-21 10:34:44 +01:00
Yorhel
14b90444c9 Version 2.0-beta3 2021-11-09 09:11:35 +01:00
Yorhel
5b462cfb7a Fix export feature
...by making sure that Context.parents is properly initialized to null
when not scanning to RAM.

Fixes #179.
2021-11-02 15:29:12 +01:00
Yorhel
7efd2c6251 Make options, keys and file flags bold in man page
Port of 96a9231927
2021-10-07 10:33:01 +02:00
Yorhel
90873ef956 Fix defaults of scan_ui and --enable-* flags
Bit pointless to make these options nullable when you never assign null
to them.
2021-10-06 15:32:49 +02:00
Yorhel
8a23525cac Fix double-slash prefix in path display when scanning root 2021-10-06 14:49:40 +02:00
Yorhel
929cc75675 Fix import of "special" dirs and excluded items 2021-10-06 14:32:02 +02:00
Yorhel
fdb93bb9e6 Fix use-after-free in argument parsing
Introduced in 53d3e4c112
2021-10-06 14:06:50 +02:00
Yorhel
d1adcde15c Add --ignore-config command line option 2021-10-06 13:59:14 +02:00
Yorhel
39a137c132 Add reference to "man ncdu" in --help text
Not going to bloat the help output with all those settings...
2021-10-06 13:52:08 +02:00
Yorhel
53d3e4c112 Make argument parsing code non-generic and simplify config file parsing
Saves about 15k on the binary size. It does allocate a bit more, but it
also frees the memory this time.
2021-10-06 11:52:37 +02:00
Yorhel
4b1da95835 Add configuration file support 2021-10-06 11:05:56 +02:00
Yorhel
88c8f13c35 Add CLI options for default sort 2021-10-06 09:21:13 +02:00
Yorhel
900d31f6fd Add CLI options for all UI settings
+ reorder manpage a bit, since the scan options tend to be more relevant
than all those UI options.

Again, these are mainly useful with a config file.
2021-10-05 17:17:01 +02:00
Yorhel
d005e7c685 Document the 'u' key
Might as well keep it. The quick-config menu popup idea can always be
implemented later on, we're not running out of keys quite yet.
2021-10-05 16:32:36 +02:00
Yorhel
b3c6f0f48a Add CLI options for individual -r features and to counter previous options
The --enable-* options also work for imported files, this fixes #120.

Most other options are not super useful on its own, but these will be
useful when there's a config file.
2021-10-05 16:27:23 +02:00
Yorhel
bfead635e4 Don't enable -x by default
That was an oversight. Especially useless when there's no option to
disable -x.
2021-09-28 17:56:09 +02:00
Yorhel
f448e8ea67 Add dark-bg color scheme + enable colors by default if !NO_COLOR
Same thing as commit 376aad0d35 in the C
version.
2021-08-16 16:33:23 +02:00
Yorhel
1de70064e7 Version 2.0-beta2 + more convenient static binary generation 2021-07-31 07:14:04 +02:00
Yorhel
5929bf57cc Keep track of uncounted hard links to speed up refresh+delete operations 2021-07-28 20:12:50 +02:00
Yorhel
ba14c0938f Fix Dir.fmtPath() when given the root dir 2021-07-28 20:09:48 +02:00
Yorhel
3acab71fce Fix reporting of fatal scan error in -0 or -1 UIs 2021-07-28 11:13:03 +02:00
Yorhel
0d314ca0ca Implement a more efficient hard link counting approach
As aluded to in the previous commit. This approach keeps track of hard
links information much the same way as ncdu 1.16, with the main
difference being that the actual /counting/ of hard link sizes is
deferred until the scan is complete, thus allowing the use of a more
efficient algorithm and amortizing the counting costs.

As an additional benefit, the links listing in the information window
now doesn't need a full scan through the in-memory tree anymore.

A few memory usage benchmarks:

              1.16  2.0-beta1  this commit
root:          429        162          164
backup:       3969       1686         1601
many links:    155        194          106
many links2*:  155        602          106

(I'm surprised my backup dir had enough hard links for this to be an
improvement)
(* this is the same as the "many links" benchmarks, but with a few
parent directories added to increase the tree depth. 2.0-beta1 doesn't
like that at all)

Performance-wise, refresh and delete operations can still be improved a
bit.
2021-07-28 10:35:56 +02:00
Yorhel
36bc405a69 Add parent node pointers to Dir struct + remove Parents abstraction
While this simplifies the code a bit, it's a regression in the sense
that it increases memory use.

This commit is yak shaving for another hard link counting approach I'd
like to try out, which should be a *LOT* less memory hungry compared to
the current approach. Even though it does, indeed, add an extra cost of
these parent node pointers.
2021-07-26 14:03:10 +02:00
Yorhel
b94db184f4 ChangeLog, too 2021-07-23 06:38:50 +02:00
Yorhel
7055903677 Fix README Zig version oopsie 2021-07-23 06:28:56 +02:00
Yorhel
e72768b86b Tagging this as a 2.0-beta1 release 2021-07-22 16:29:55 +02:00
Yorhel
a915fc0836 Fix counting of sizes for new directories 2021-07-19 16:58:34 +02:00
Yorhel
f473f3605e Fix building of static binaries
It's a bit ugly, but appears to work. I've not tested the 32bit arm
version, but the others run.

The static binaries are about twice as large as the ncdu 1.x
counterparts.
2021-07-19 16:44:53 +02:00
Yorhel
b96587c25f scan: Don't allocate directory iterator on the stack
I had planned to checkout out async functions here so I could avoid
recursing onto the stack alltogether, but it's still unclear to me how
to safely call into libc from async functions so let's wait for all that
to get fleshed out a bit more.
2021-07-18 16:43:02 +02:00
Yorhel
6f07a36923 Implement help window
The rewrite is now on feature-parity with ncdu 1.x. What remains is
bugfixing and polishing.
2021-07-18 16:39:19 +02:00