Commit Graph

564 Commits (7256b055b17ebbe0068f5816d0bfeb30f0a7721a)

Author SHA1 Message Date
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
Benno Schulenberg 0d9397e5b0 Making ^O work the same way as under Pico when option -t is given:
writing out the file immediately, without prompting.
Patch by David Lawrence Ramsey.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5378 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-29 10:36:07 +00:00
Benno Schulenberg 459d9f8ba8 Rewrapping some lines and tweaking two comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5368 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-29 20:14:57 +00:00
Benno Schulenberg 8925eabd5e Not bothering to set things to NULL when they will be initialized right away,
nor bothering with a separate initialization function when it's used only once.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5365 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-16 15:21:32 +00:00
Benno Schulenberg 149b1fe439 Removing some duplication in the initialization of a new openfile node.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5364 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-16 13:05:35 +00:00
Benno Schulenberg 07fdf46154 Avoiding a possibly erroneous message, because failing to delete
the temporary file does not mean that copying failed.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5353 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-11 17:43:08 +00:00
Benno Schulenberg c9337dd4ed Avoiding a call of copy_file() with a null pointer.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5352 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-11 17:27:30 +00:00
Benno Schulenberg eac0446c86 Fixing compilation with --enable-tiny: file formats don't exist then.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5349 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-09 16:31:01 +00:00
Benno Schulenberg 70cbbda87c Adding the option --unix (and 'set unix'),
to save a file by default in Unix format.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5342 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-04 18:49:57 +00:00
Benno Schulenberg 455fb4f063 Plugging a memory leak.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5340 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-03 08:32:52 +00:00
Benno Schulenberg 8a06dfa4d7 Initializing also openfile->syntax.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5338 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-02 20:27:45 +00:00
Benno Schulenberg 6847616aee Differentiating between something being disabled/restricted and
help texts being unavailable.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5331 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-30 18:10:16 +00:00
Benno Schulenberg ee7b095678 Adding a new bindable function that writes a file to disk without
first asking for its name.  Patch was suggested by Seiya Nuta.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5318 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-25 19:25:50 +00:00
Benno Schulenberg 474b390816 Plugging a few memory leaks.
Patch by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5314 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-22 18:02:36 +00:00