Commit Graph

838 Commits (e0c4f9c5feec4a6d7311ec1ad26cf8de3da94ec0)

Author SHA1 Message Date
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
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 1bebe34b56 Preventing valid pointers from getting truncated and rejected.
Patch by Mike Frysinger, tweaked by Benno.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5508 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-23 14:05:47 +00:00
Benno Schulenberg 31f0456e9a Moving two functions to the color.c file, where they belong.
And making the checking for an impatient user into a separate routine.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5501 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-22 16:51:00 +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 a64bfbee8b Letting also unlink_node() update 'filebot', instead of doing it in
four different places.  It is not a problem that the history routines
also use these functions, as history nodes will never equal filebot.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5491 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-08 16:02:05 +00:00
Benno Schulenberg 77c0357868 Making splice_node() update 'filebot', instead of doing it in
four different places.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5490 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-08 15:29:56 +00:00
Chris Allegretta c4a6725ad6 2015-12-05 Chris Allegretta <chrisa@asty.org>
* src/nano.c (main) : key_defined() is an ncurses-ism.  Add
	better checks for this.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5482 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-06 05:21:43 +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 b1d6d7f95c Initializing a newly allocated multidata array.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5447 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-28 19:03:33 +00:00
Benno Schulenberg be01647a18 Allowing the user full control over the values of MALLOC_CHECK_ and
MALLOC_PERTURB_; nano shouldn't override them.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5446 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-28 17:29:39 +00:00
Benno Schulenberg 438cb110ff Refreshing the whole edit window only when there are multiline regexes,
and checking for this just once for every burst of keystrokes.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5439 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-25 09:10:02 +00:00
Benno Schulenberg e0d0ca4b97 Renaming a variable for clarity.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5438 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-24 13:28:32 +00:00