Commit Graph

577 Commits (813f9f72d0669ba882c3adb38ba24873e9e32b68)

Author SHA1 Message Date
Benno Schulenberg 65efed5f97 Freeing the position-history records that are dropped.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5629 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-10 20:29:23 +00:00
Benno Schulenberg d83bd7e305 Plugging a sneaky memory leak. This fixes Savannah bug #47003
reported and solved by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5624 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-10 12:32:43 +00:00
Benno Schulenberg cdeb90515b Checking the result of a stat() to avoid referencing unitialized data.
The original patch was by Kamil Dudka.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5621 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-09 20:53:11 +00:00
Benno Schulenberg 98a8c06394 Eliding an unneeded 'if'.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5617 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-07 13:08:27 +00:00
Benno Schulenberg 12f27299f1 Avoiding a pointless lstat() when not writing to a temporary file.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5616 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-07 13:03:48 +00:00
Benno Schulenberg 05334a2b3c Not recording files that have the default cursor position.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5615 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-07 12:49:42 +00:00
Benno Schulenberg 22a01cad9e Rewrapping some lines and removing some useless comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5614 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-06 12:12:08 +00:00
Benno Schulenberg 6829241433 Removing the --nofollow option that hasn't been working for a dozen years.
With this option, nano would simply refuse to write to any symlinked file;
if anyone really used this option, they would certainly have complained.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5608 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-06 10:59:31 +00:00
Benno Schulenberg ba987350a9 Being more specific in how a given path is invalid.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5602 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-31 13:06:06 +00:00
Benno Schulenberg f96f4fe616 Updating position history only when 'positionlog' is set.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5601 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-29 20:43:54 +00:00
Benno Schulenberg 68ab4b848b Plugging another memory leak.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5600 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-29 20:39:12 +00:00
Benno Schulenberg 41f08534d9 Plugging a couple of memory leaks.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5598 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-29 16:58:02 +00:00
Benno Schulenberg d8801ec10e Also displaying the buffer when configured with only --disable-histories.
This fixes a segfault reported in Savannah bug #47011.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5596 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-29 16:01:43 +00:00
Benno Schulenberg 7256b055b1 Not adding directories to the list of file positions.
This fixes Savannah bug #46971.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5592 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-26 09:06:31 +00:00
Benno Schulenberg ae42240c33 Handling an update of the first element correctly.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5589 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-25 20:26:01 +00:00
Benno Schulenberg 8c705b5dc2 Moving an updated position-history item to the end of the list,
so that it won't be dropped any time soon.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5582 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-24 14:49:42 +00:00
Benno Schulenberg cd1d435ac7 Renaming a variable for clarity and contrast.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5581 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-22 16:56:04 +00:00
Benno Schulenberg fe3d849a75 Getting rid of a global variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5574 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-20 15:56:40 +00:00
Benno Schulenberg a91a1c7bbd Readjusting the indentation and a comment.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5573 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-20 15:33:41 +00:00
Benno Schulenberg 8bd76d8302 Verifying that the containing directory of the given filename exists.
Original patch by Rishabh Dave, edited by Benno.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5572 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-20 15:14:52 +00:00
Benno Schulenberg f8f2d63107 Limiting the number of loaded items in the positions history.
(So that most likely not more than two hundred plus a handful
will be written out.  This was the easiest to implement.)

See https://lists.gnu.org/archive/html/nano-devel/2016-01/msg00050.html.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5571 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-17 17:04:28 +00:00
Benno Schulenberg 38acacb461 Moving set_modified() to the file that has to do with files.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5566 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-15 14:42:07 +00:00
Benno Schulenberg caa759be31 Returning a fantastic file descriptor -- when opening
a non-existent file for reading succeeds.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5565 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-15 14:23:50 +00:00
Benno Schulenberg 0ee7729666 Freeing the full filename in all cases.
There's a bunch of return cases where we don't free the new full filename
which leads to leaks when writing out new files.  One way to reproduce:
$ rm -f foo
$ nano foo
<hit enter>
<ctrl+o to save>
<ctrl+x to exit>
-> memory leak

Patch by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5563 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-15 13:17:44 +00:00
Benno Schulenberg 34fbb1f4de Adjusting a few comments and rewrapping some lines.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5556 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-13 20:32:40 +00:00
Benno Schulenberg ecf3cd7244 Reducing the number of indentation steps elsewhere too.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5555 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-13 20:08:36 +00:00
Benno Schulenberg 96b9249f91 Reducing the number of indentation steps.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5554 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 20:26:59 +00:00
Benno Schulenberg 774c8ba1bf Condensing the preparsing of a line.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5553 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 20:17:05 +00:00
Benno Schulenberg 73ee7d7ee5 Removing a senseless iteration: simply add the new record at the tail.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5552 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 20:08:31 +00:00
Benno Schulenberg deb271d708 Differentiating a variable name from function names.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5551 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 19:20:40 +00:00
Benno Schulenberg cb832bef1b Removing some code duplication.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5550 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 19:07:01 +00:00
Benno Schulenberg 583b67bad2 Rename a variable, to match the save routine.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5549 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 11:16:39 +00:00
Benno Schulenberg 46db638435 Chopping a duplicate parameter.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5519 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-31 19:20:40 +00:00
Benno Schulenberg 1592ca0585 Chopping an always FALSE parameter.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5518 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-31 17:20:46 +00:00
Benno Schulenberg 37d8ad8687 Not trying to position the cursor when opening a buffer failed.
This fixes Savannah bug #46778.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5514 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-30 10:11:20 +00:00
Benno Schulenberg 480b6a320f Going back to the filename prompt when the user decides to save a
changed buffer after all, as the buffer may not have a name yet.
This fixes Savannah bug #46752.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5512 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-23 19:18:33 +00:00
Benno Schulenberg 31e1af646c Not opening an extra blank buffer when an empty file is read.
This bug was exposed by r5498 on December 18.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5511 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-23 16:44:39 +00:00
Benno Schulenberg 8cc6308f9c Offering ^Q in the writeout menu to close and discard the current buffer
without saving it.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5509 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-23 16:34:44 +00:00
Benno Schulenberg 277f58f8d8 History: no prompting on exit errors, because making the user hit Enter when
there's an error saving history state at exit is pointless and annoying.
Just notify the user and move on.
Patch by Mike Frysinger, tweaked and extended by Benno.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5507 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-23 13:37:55 +00:00
Benno Schulenberg 5737fe3461 Precalculating the multiline-regex cache data for each buffer,
not just for the first.  This fixes Savannah bug #46511.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5500 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-20 21:10:41 +00:00
Benno Schulenberg 72760159e7 Tweaking some comments and improving a variable name.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5499 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-18 20:44:01 +00:00
Benno Schulenberg 22e9283520 Chopping a superfluous boolean parameter -- 'prevnode' being NULL is
enough indication that the first line is being read.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5498 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-18 19:18:23 +00:00
Benno Schulenberg cac3c3399f Making ^O always prompt for a filename, also when --tempfile is given.
Users who want an immediate save, can bind the function 'savefile'.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5489 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-07 17:05:04 +00:00
Benno Schulenberg bb31118fcb Avoiding two compilation warnings.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5481 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-05 11:38:26 +00:00
Benno Schulenberg f2da466388 Rewrapping some lines and tweaking some comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5478 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-04 21:11:10 +00:00
Benno Schulenberg 4ea55c3bf7 Renaming two variables for clarity.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5459 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-01 11:43:13 +00:00
Benno Schulenberg 6a88d8a737 Marking the current buffer as mofified only when actually something
was inserted.  This fixes Savannah bug #45409.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5458 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-01 11:39:04 +00:00
Benno Schulenberg 42ac5368e1 Allowing an array parameter to be NULL.
This fixes Savannah bug #46420.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5457 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-30 16:44:44 +00:00
Benno Schulenberg 619f28077c Plugging four memory leaks.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5399 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-10 15:09:36 +00:00
Benno Schulenberg 4ede3b494f Truncating an overlong hostname properly instead of bailing out
when writing a lock file.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5391 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-06 20:14:37 +00:00