Commit Graph

280 Commits

Author SHA1 Message Date
Arun Prakash Jana afb6a7ab04
Change bookmark prompt and pin dir keys.
New keys:

- bookmark prompt (^B)
- pin directory (B)

The intention of the change is to facilitate opening the bookmark prompt in
navigate-as-you-type mode. The bookmark prompt is used more than the pin
current directory option.
2018-01-07 09:14:25 +05:30
Arun Prakash Jana f7c5a2924d
Highest priority to desktop search, rename 2018-01-07 03:27:09 +05:30
Arun Prakash Jana 2e7722976b
Enable extra shortcuts in navigate-as-you-type mode
Enabled functionality:

- Copy file path (^K)
- Run desktop search utility (^/)
- Rename file (^R)
- Open with... (^O)
- Pin current directory (^B)
- Visit pinned directory (^V)
- Extract archive (^X)
2018-01-06 11:58:01 +05:30
Arun Prakash Jana 542fd2f6e8
Swap weekday and month 2018-01-06 10:01:54 +05:30
Arun Prakash Jana d69365ff3e
Use a date format string 2018-01-06 03:59:36 +05:30
Arun Prakash Jana 5876c61f4c
Rearrange date format in file details 2018-01-06 03:56:09 +05:30
codeliveroil 915df53a04 Use standard date formats. (#74)
- For standard view, use ISO 8601 date format.
- For detailed view (i.e. stat), use default Linux date
  format. Also, remove GMT offset to avoid confusion in
  determining source of offset when reading alongside
  the local time zone.
2018-01-06 03:49:27 +05:30
Arun Prakash Jana fd11b53b4e
Show target for symlinks 2018-01-06 03:46:44 +05:30
Arun Prakash Jana 00533546d4
The *alloc() family is aligned 2018-01-04 17:46:06 +05:30
Arun Prakash Jana 242e22eb2d
Wrap realloc() to return aligned address 2018-01-04 06:23:20 +05:30
Arun Prakash Jana da7e30cd6f
Use aligned large buffers 2017-12-30 13:54:49 +05:30
Arun Prakash Jana 3a88e31a0e
Check alignment and enable -O3 2017-12-29 11:08:07 +05:30
Arun Prakash Jana 9b010b1c03 Fix checkpatch reports 2017-12-28 01:48:12 +05:30
Daniel Lockyer 77b0fe0104 Free allocated resources using regfree (#71) 2017-12-27 16:06:57 +05:30
Arun Prakash Jana 26e739a6d9
Use ffs() tweak. 2017-12-27 09:53:11 +05:30
Arun Prakash Jana ff1c467285
Explicitly cast opaque types 2017-12-27 00:49:43 +05:30
Arun Prakash Jana f1f2a53dbf TAB is not identified on OS X 2017-12-27 00:16:56 +05:30
Dmitri Goutnik 4dca8d7cf9 Lookup xdg-open in PATH on non-Apple platforms (#70) 2017-12-26 23:53:20 +05:30
Arun Prakash Jana 9bfc2fdc29
Use ffs() instead of ffsl() 2017-12-26 23:33:32 +05:30
Dmitri Goutnik c5f19ddd92 Fix compiler warnings on FreeBSD 11.x (#69) 2017-12-26 21:22:45 +05:30
Arun Prakash Jana 9b72fcba03
Replace getorder() by ffsl() 2017-12-25 23:27:37 +05:30
Arun Prakash Jana cd177086ca
OpenSUSE gcc fails at '-fno-tree-loop-vectorize' 2017-12-25 19:10:20 +05:30
Arun Prakash Jana f687463574
Prepare for release v1.6 2017-12-25 17:13:25 +05:30
Arun Prakash Jana 7f804ca8f2
Support 'Open with...' 2017-12-25 15:55:53 +05:30
Arun Prakash Jana f7399b05f9
Optimize xmemrchr() 2017-12-25 01:44:48 +05:30
Arun Prakash Jana 436d2143fd
Reduce sprintf() family usage 2017-12-25 00:28:12 +05:30
Arun Prakash Jana c0255db4f1
Optimize saving, matching old entry 2017-12-24 23:23:52 +05:30
Arun Prakash Jana 78f544c41d
Shorten error messages 2017-12-24 21:22:54 +05:30
Arun Prakash Jana f2387898f3
Limit filter length to NAME_MAX from LINE_MAX 2017-12-24 21:20:36 +05:30
Arun Prakash Jana 959db96f99
Use const if applicable 2017-12-24 21:03:23 +05:30
Arun Prakash Jana 8b98df0be1
Update documentation 2017-12-24 18:46:56 +05:30
Arun Prakash Jana 8189411aef
Users understand 'DIR' easier then 'cwd' 2017-12-24 15:23:33 +05:30
Arun Prakash Jana d9537e6d49
Add option -b to open bookmark directly 2017-12-24 15:21:38 +05:30
Arun Prakash Jana d3797f21d1
Order numeric file names (helps with /proc) 2017-12-24 03:15:22 +05:30
Arun Prakash Jana 59ae6c9e7f
Replace xstricmp() with strcoll() 2017-12-22 01:19:32 +05:30
Arun Prakash Jana a451e74465
Remove redundant variable 2017-12-22 00:58:02 +05:30
Arun Prakash Jana 04bf7537e5
Consider only symbolic or only nunmeric names 2017-12-22 00:56:15 +05:30
Arun Prakash Jana 2f86e0d107
No need to test end of numeric 2017-12-21 19:12:12 +05:30
Arun Prakash Jana 988a3dd621
Ignore punctuation marks in file name compare. Fix xstrcmp().
1. File name comparison method:
 - initially ignore white space and punctuation characters
 - run test for numeric values
 - if the remaining substrings match in case-insensitive compare, compare case
 - if they still match, see which one has more prefix symbols
 - if they still match, run a case-sensitive compare on complete strings

2. Fixed xstrcmp() to return diff instead of 0 and -1.
2017-12-21 17:49:31 +05:30
Arun Prakash Jana 0945dfb91a
Add file name len to entry structure 2017-12-20 22:20:28 +05:30
Arun Prakash Jana bc1e74bc56
Offset can be derived 2017-12-20 08:18:37 +05:30
Arun Prakash Jana 106c7c2371
Retire redundant variable 2017-12-20 00:42:11 +05:30
Arun Prakash Jana d135af33af
A fancier func to get order of 2 2017-12-20 00:01:32 +05:30
Arun Prakash Jana cc1891d351
Replace a large buf with global g_buf 2017-12-19 23:33:27 +05:30
Arun Prakash Jana ded690c693
Use exact number of bytes for each filename.
Results in even less memory usage. The names are appended one after another.
The offsets are reset when the location of the memory changes die to realloc().

Other changes:

1. Use a debug mode print to measure time.
2. Remove redundant prefix when printing pointers in debug mode.
2017-12-19 01:16:03 +05:30
Arun Prakash Jana 8307bc95bd
Fix #64: change printf() to printw() 2017-12-18 00:30:48 +05:30
Arun Prakash Jana ca28580746
NAME_MAX does not include NULL char 2017-12-18 00:00:08 +05:30
Arun Prakash Jana 7a16440e1f
An even faster nnn - no more copying file names!
nnn has been using `struct entry` to hold both file name as well as file info.

The design forces file names to be copied in the following cases:

 - swaps during file sort (nnn uses quicksort) applied after all the matching
   files are read (in no particular order; good old readdir()) into memory.
 - swaps during manual filtering. nnn moves non-matching entries below so they
   are not encountered twice resulting in fast filtering.

There were scopes for _massive_ improvements in this area. So I did what had to
be done - decouple the file names from `struct entry` and use a separate struct
to hold the names with the indices set when the files are added by opendir().

There was a hidden problem to this approach - nnn uses realloc() to allocate
memory for file information and realloc() may move the original pointer in mem
when it can't fit the new memory to the earlier pointer. To handle that the new
algorithm tracks the change in memory location and re-adjusts the existing dir
entry names when that happens; this too, without any copying!

Though the results seem pretty clean from a theoretical point of view and early
tests, we may uncover some bugs. However, the speed is just mind-blowing!

And the binary size remains the same too!!!
2017-12-17 23:08:55 +05:30
Arun Prakash Jana ef3eab073e
Fix indentation 2017-12-14 19:17:29 +05:30
Arun Prakash Jana c3545dd82f
Use static vars in frequently used APIs 2017-12-13 02:41:30 +05:30