Commit Graph

850 Commits (3e5fcec76c12b45a5dd12cb731e160c8e8fb1e0c)

Author SHA1 Message Date
Benno Schulenberg 3e5fcec76c remove the GNU marker from nano's name
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-06-13 12:22:33 +02:00
Benno Schulenberg aa09abe198 files: when the requested operating directory cannot be set, fail
Specifying an operating directory should either lead to a successfull
confinement, or nano should fail to start.

(Also: save the terminal settings as soon as possible, so that an early
die() will not restore uninitialized values.)

This fixes the first part of https://savannah.gnu.org/bugs/?47798 properly.
2016-06-12 11:13:45 +02:00
Benno Schulenberg 17cf833b9c tweaks: normalize some whitespace 2016-05-30 09:09:36 +02:00
Benno Schulenberg e3e3f655ee tweaks: use an available macro to silence a compiler warning 2016-05-27 21:48:38 +02:00
Benno Schulenberg 3129ff687a tweaks: rename a variable, because nothing is returned there 2016-05-27 21:43:39 +02:00
Mike Scalora 6a2032f5b0 new feature: comment/uncomment current line or selected lines
This allows for commenting or uncommenting a line or a bunch of lines
with a single keystroke (default binding: M-3).  The characters used
for commenting/uncommenting are specified by the active syntax file.

Reviewed-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Mike Scalora <mike@scalora.org>
2016-05-25 22:29:50 +02:00
Benno Schulenberg c0285682e4 startup: show an error message when argument of --operatingdir is invalid
Move the initialization of the operating directory to after the
initialization of the screen, so that the above error can be shown.

This fixes the first part of https://savannah.gnu.org/bugs/?47798.
2016-05-22 11:41:58 +02:00
Benno Schulenberg c8f530af93 statusbar: add a non-beeping message type that does not get overwritten
Error messages about lock files should not get overwritten by purely
informational messages, only by alerting ones.

This fixes https://savannah.gnu.org/bugs/?47963.
2016-05-21 13:58:09 +02:00
Benno Schulenberg 906ada8fe7 files: remove the special 'quiet' mechanism for not overwriting messages
The general mechanism for not allowing important messages to be overwritten
will take care of not overwriting warnings about failed file lockings.
2016-05-18 12:04:45 +02:00
Benno Schulenberg 2535f51e01 statusbar: prevent error messages from overwriting each other
If during startup there are multiple error messages, currently only the
last one remains and can be read.  To improve on that, introduce a short
pause between error messages -- even if it's not enough to read them all,
at least the user will be aware that there are multiple ones.

This also causes a few error messages to beep that currently don't beep,
such as when a file is unwritable.
2016-05-16 18:03:07 +02:00
Benno Schulenberg 04a230f933 tweaks: avoid a warning when configured with --disable-wrapping 2016-05-16 16:36:49 +02:00
Benno Schulenberg 318ed6b105 scrolling: center the cursor when inserted stuff does not fit on screen
Since nano-2.4.1, reading in or pasting a large piece of text would put
the cursor on the bottom line, leaving only one line of the non-read or
non-pasted text visible.  This is different from the centering behavior
of Pico, and somewhat disorienting, as you can't see "where you are" any
more in relation to the file as it was.

So now center the cursor whenever the read or pasted text is larger than
the screen, but don't center it when the text fits entirely on the screen.
(The latter avoids the effect of the screen jumping unnecessarily when
inserting just a few lines while the cursor is near the bottom.)

To achieve this behavior: default to focusing, and temporarily set it to
FALSE when the focusing effect is unwanted.

This fixes https://savannah.gnu.org/bugs/?47841.
2016-05-04 10:13:36 +02:00
Benno Schulenberg e0c4f9c5fe input: give more detailed feedback when an unbound key is struck 2016-05-01 22:04:32 +02:00
Benno Schulenberg 53f4a9f5a8 screen: rename 'edit_refresh_needed' to 'refresh_needed'
For a little contrast with the function edit_refresh() -- it's
annoying that when you search for the latter you get to see all
the settings of the flag too.
2016-04-25 21:14:18 +02:00
Benno Schulenberg b97c36c218 screen: don't always set 'edit_refresh_needed' when adjusting edittop
The function edit_update() is called by edit_refresh() itself, so it is
silly that the first sets 'edit_refresh_needed' to TRUE.  This setting
is needed only in a few cases -- in the others it's not needed because
the screen does not need to be refreshed (it was just about positioning
the cursor), or 'edit_refresh_needed' has already been set by a call to
goto_line_posx().  So, just set the flag in the five places that need it
and spare the other four calls.
2016-04-25 20:17:40 +02:00
Benno Schulenberg 907ba3a2e2 scrolling: catch the special case of reading a file from standard input
Since commit dac0aa1, nano would leave edittop at current after reading
data from standard input, meaning that everything that had been read in
was invisible, "scrolled off" the top of the screen.  Correct this by
explicitly setting edittop.

The above does not happen for ^R (^X) because it has a special mechanism
to save and restore edittop.  Nor does it happen for ^R ^X M-F because it
sets current to the top of the file and refreshing the screen will make
edittop follow, or -- in case just one unterminated line was read in --
edittop will already be equal to current.
2016-04-25 17:48:06 +02:00
Benno Schulenberg 34a20f8839 prompt: properly save and restore the x position in the statusbar
This fixes https://savannah.gnu.org/bugs/?47720.
2016-04-17 15:24:05 +02:00
Benno Schulenberg ec295f5e68 build-sys: detect a build from git and show its short commit hash 2016-04-12 10:28:45 +02:00
Benno Schulenberg aa1ae0a144 screen: concentrate the setting of placewewant
Instead of saving the current value of placewewant, then setting the
new value, and then passing the old value to edit_redraw() in seven
different places, just let edit_redraw() do this saving and setting.

In the bargain placewewant is now only recalculated when it matters
-- when allow_update is TRUE -- and not when it's superfluous.
2016-04-11 20:38:05 +02:00
Benno Schulenberg cb17732ac2 scrolling: don't scroll too much when having to bridge blank lines
Add a third mode of scrolling, FLOWING, besides CENTERING and STATIONARY.
This is used for word and paragraph jumping (and for bracket matching,
but that worked correctly already), and only when focusing is FALSE.

The new mode prevents the screen from scrolling too many lines when
there are several blank lines at the bottom of the edit window and
the next word or paragraph is out of view.

This fixes https://savannah.gnu.org/bugs/?47194.
2016-04-07 14:28:25 +02:00
Benno Schulenberg d92eb4fee3 all: eradicate SVN's $Id$ tags 2016-04-05 14:59:12 +02:00
Benno Schulenberg 7561b1b026 Placing the cursor in the edit window also when --constantshow is in effect.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5770 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-29 12:14:00 +00:00
Benno Schulenberg 51743233ed Removing the 'last_replace' variable that is never used.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5768 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-28 19:14:33 +00:00
Benno Schulenberg 2f817a6740 Checking for the existence of the REG_ENHANCED regex flag, and
using it when it's available (which it is on OS X systems).
This completes the fix for Savannah bug #47325.
Patch by Thomas Rosenau.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5759 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-22 10:42:28 +00:00
Benno Schulenberg 1ef62490dd Normalizing the punctuation in some prompts: no space before a question mark,
and a semicolon instead of a comma between phrases.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5750 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-20 10:57:14 +00:00
Benno Schulenberg 486e828443 Eliding splice_opennode() by handling the two cases (the creation of
the first element, and the insertion of a new element) directly.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5678 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-25 18:58:17 +00:00
Benno Schulenberg f5eb316603 Rewrapping and reshuffling some lines.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5673 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-23 12:37:10 +00:00
Benno Schulenberg a9a32d6d89 Centering the cursor when the thing being undone or redone is currently
off the screen.

See https://lists.gnu.org/archive/html/nano-devel/2016-02/msg00104.html.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5672 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-23 12:18:10 +00:00
Benno Schulenberg f4f9954556 Eliding the function free_openfilestruct() as it is used only once.
(Note that openfile cannot be NULL here.  And in case it is,
nano should crash because DEBUG is enabled.)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5658 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 09:02:58 +00:00
Benno Schulenberg 9703934479 Allowing the parameter of free_filestruct() to be NULL,
so we can delete four annoying pre-checks.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5651 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-18 19:58:18 +00:00
Benno Schulenberg 568d2a389c Switching the cursor on and off at the appropriate moments (that is: when
needed), so that it no longer shows in the help screen nor in the file list.
This fixes Savannah bug #47126.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5640 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-13 19:41:12 +00:00
Benno Schulenberg b8e0e22d64 Switching the cursor on in the right place: in the central input routine.
This makes the cursor visible again during linting.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5628 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-10 20:16:50 +00:00
Benno Schulenberg 97dcd377e7 Turning the cursor off when writing in the status bar,
and ensuring it is on when waiting for input.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5610 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-06 11:18:27 +00:00
Benno Schulenberg cc2d37053c Updating the screen immediately when a message is posted on the status bar.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5609 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-06 11:05:58 +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 98e72f50e6 Checking the position history only when 'positionlog' is set
/also/ for the first file.  :|


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5599 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-29 17:18:27 +00:00
Benno Schulenberg f8ed6bb099 Checking the position history only when option 'positionlog' is set.
This fixes a bug reported by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5597 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-29 16:20:28 +00:00
Benno Schulenberg 7a1709f03b Removing a now unneeded function, as nothing can break out of do_prompt()
any more, not a SIGWINCH either.  And deleting an always-FALSE 'if'.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5577 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-21 18:23:17 +00:00
Benno Schulenberg f845938e86 Freeing the items on the undo stack when a buffer is closed.
This fixes Savannah bug #46904 reported by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5567 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-15 16:44:50 +00:00
Benno Schulenberg 1b293ff34c Adjusting dates and version number.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5542 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-10 16:18:43 +00:00
Benno Schulenberg 9e6b9a29a5 Improving the name of allow_pending_sigwinch() to allow_sigwinch(),
and improving its comments too.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5532 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-04 10:37:11 +00:00
Benno Schulenberg dd29c56993 Rewriting the loop, and constifying the input of sctofunc().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5530 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-04 09:52:43 +00:00
Benno Schulenberg 42a761e77f Adjusting the indentation after the previous change.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5527 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-03 17:37:05 +00:00
Benno Schulenberg 0d85c8c68c Alerting the user when a functionless shortcut is encountered.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5526 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-03 17:07:29 +00:00
Benno Schulenberg a5bc70a541 Aborting reset_multis() when there are zero multiline regexes.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5525 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-03 16:57:17 +00:00
Benno Schulenberg 37712fb120 Letting reset_multis() figure out whether after an addition a full refresh is
needed (for the sake of multiline regexes), instead of doing it always.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5524 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-03 16:21:04 +00:00
Benno Schulenberg 5765e9675f Letting reset_multis() figure out whether after a deletion a full refresh is
needed, before doing a redraw of the current line.
This fixes Savannah bug #46794


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5523 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-03 15:35:52 +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