Commit Graph

5444 Commits (023fccb96661919eb1ede3342c8e3c460e62ff47)

Author SHA1 Message Date
Benno Schulenberg 023fccb966 search: avoid saving and restoring placewewant when bracket matching
Now that findnextstr() no longer sets placewewant, we can can make
a copy of the old value just where needed: when a bracket is found.
2016-04-10 11:14:03 +02:00
Benno Schulenberg ea4e9b3156 search: don't set placewewant when we are just iterating
In the innermost search loop, don't set placewewant, because this loop
is also used for replacing and spell fixing, when we don't really want
to be there: we are just passing through.  Not setting placewewant means
we don't need to save and restore it in those passing-through routines.

The value of placewewant is only relevant when doing cursor movement,
which doesn't happen during replacing nor spell checking, so there is
no need to keep placewewant up to date -- it is set when it matters:
at the end of go_looking().
2016-04-10 11:11:24 +02:00
Benno Schulenberg 7ba356a62c searching: don't keep track of current_y, but calculate it at the end
Stop keeping track of the vertical screen position when searching for
something.  If nothing is found, current_y doesn't change, and all the
incrementing/decrementing was a waste of time.  If something is found
and it is onscreen, it is easy to calculate the new current_y.  And if
something is found and it is offscreen, then current_y is irrelevant,
because we will be either centering the found occurrence (searching)
or putting it on the top or bottom line (bracket matching).

(The above does not take softwrapping into account, but neither did
the old code, so this doesn't introduce any new bugs.)

(Also, when the search wraps, and the viewport is away from head or
tail of the file, and the found occurrence is within the viewport,
then the incremented/decremented current_y would be way wrong, but
this didn't have any adverse effects as far as I could tell.  It
seems that current_y is irrelevant in most cases.)
2016-04-08 18:31:15 +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
Mike Scalora d851ccdd41 keyboard: recognize four escape sequences produced by iTerm2
On iTerm2 on OS X, the Option+Arrow keys produce special sequences
that start with two escapes.  Catch these sequences and interpret
them appropriately as WordLeft / WordRight / Home / End.

Signed-off-by: Mike Scalora <mike@scalora.org>
Signed-off-by: Thomas Rosenau <thomasr@fantasymail.de>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-04-05 21:00:54 +02:00
Benno Schulenberg da9ea91b37 build-sys: ignore .patch, .orig and .swp files 2016-04-05 17:14:30 +02:00
Benno Schulenberg 54217ea500 i18n: advise the translators about the maximum length of some strings 2016-04-05 16:29:36 +02:00
Benno Schulenberg ba38d61f22 files: prune a message to be less than 76 characters
So it will fit on the screen when using a standard 80-column terminal.
2016-04-05 16:13:54 +02:00
Benno Schulenberg 4a9b97b101 help: only speak of Control and Meta sequences
Don't call the latter ones Escape sequences, because both Control
and Meta sequences can be entered using the Escape key.
2016-04-05 16:11:56 +02:00
Benno Schulenberg 28b4bd7932 build-sys: identify a build from git not as one from svn 2016-04-05 15:11:09 +02:00
Benno Schulenberg dea708bf94 i18n: gather three more translatable strings into the POT file 2016-04-05 15:00:43 +02:00
Benno Schulenberg d92eb4fee3 all: eradicate SVN's $Id$ tags 2016-04-05 14:59:12 +02:00
Mike Frysinger 5cda85caaa README.GIT: update a few more points to match current tree 2016-04-04 18:46:21 -04:00
Chris Allegretta 5cb3f09a78 Rename README.SVN -> README.GIT and take out the branch details since we're generally using trunk 2016-04-04 18:08:32 -04:00
Chris Allegretta 686b784d04 Add /intl to gitignore 2016-04-04 18:03:03 -04:00
Benno Schulenberg 33a6f6a1b6 files: do not call free on the result of dirname
This fixes https://savannah.gnu.org/bugs/?47544,
and thus also http://gnats.netbsd.org/51010.

Reported-by: Adrian Siekierka <asiekierka@gmail.com>
Reported-by: Matthew Hall <mhall@mhcomputing.net>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-04-04 21:11:46 +02:00
Benno Schulenberg 284877104f search: fix compilation when configured with --enable-tiny
SVN revision 5748 could cause some 'else's to be orphaned.

This fixes https://savannah.gnu.org/bugs/?47610.

Reported-by: Thomas Rosenau <thomasr@fantasymail.de>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-04-04 19:44:39 +02:00
Benno Schulenberg 5d1752c5e3 speller: simplify the calculation of the width of the misspelled word
When finding a misspelled word, the length of the match is simply the
length of that word, and its span in columns is simply the number of
columns that it occupies.  Compute it thus directly.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-04-04 17:53:26 +02:00
Benno Schulenberg 523bc0fd4f speller: don't proceed when the user aborts the searching
When searching for a misspelled word takes a while, and the user
stops this search with ^C, then abort the spelling-checking session.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-04-04 17:43:31 +02:00
Benno Schulenberg 06ea93be3e Renaming a variable, and adjusting whitespace after the previous change.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5782 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-31 11:27:16 +00:00
Benno Schulenberg 5022e47940 Replacing a fake 'while', and deleting a redundant 'if' -- we searched
for whole words only, so it will be a whole word.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5781 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-31 11:14:25 +00:00
Benno Schulenberg c709c104a1 Unwrapping a couple of lines.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5780 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-30 12:30:14 +00:00
Benno Schulenberg 532d73ccc7 Renaming a variable to better indicate booleanness.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5779 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-30 12:27:06 +00:00
Benno Schulenberg 29cac04afc Renaming a variable for clarity.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5778 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-30 12:18:22 +00:00
Benno Schulenberg c98afde096 Renaming 'do_replace_highlight()' to 'spotlight()', for clarity,
for aptness, for contrast.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5777 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-30 12:09:39 +00:00
Benno Schulenberg 400e7ce13f Reporting "Cancelled" instead of "Not found" when the user aborts a replace
that is taking too long.  This fixes Savannah bug #47439.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5776 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-30 12:00:48 +00:00
Benno Schulenberg b834ed3b28 Chopping a parameter that is now unused, or rather: always NULL.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5775 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-29 15:05:47 +00:00
Benno Schulenberg 23b8dfd98e Allowing the user to stop replacing a word without aborting also the
whole spell-fixing session.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5774 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-29 14:56:32 +00:00
Benno Schulenberg f9d6aa9ba3 Speeding up Unicode validation.
(The measurable effect (during long searches, for example) is zero, though.)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5773 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-29 14:46:53 +00:00
Benno Schulenberg e258cc3e95 Improving the wording of an error message: the confinement of
an operating directory is not the same as restricted mode.

(In restricted mode, the file browser is not available at all.)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5772 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-29 14:16:55 +00:00
Benno Schulenberg f45a2938e3 Placing the cursor in the edit window again also after a Justify, after an
invalid escape sequence, and when entering a verbatim keystroke.
But leaving the cursor off during Unicode input, for extra feedback.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5771 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-29 14:09:17 +00: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 5fe838b072 Deleting a no-op.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5769 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-28 19:30:27 +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 108fe330d3 Providing feedback when searching takes longer than roughly half a second.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5767 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-28 19:00:19 +00:00
Benno Schulenberg 38b74e6993 Not bothering to put back the cursor in the edit window, as it is off
anyway, and it will be placed back when it's needed: in the main loop.

This prevents a segfault laid bare by r5763: when trying, at startup,
to open a directory, there really is no open buffer yet.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5766 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-28 18:53:49 +00:00
Benno Schulenberg 7f3dc2de46 Eliding an unneeded 'if' and unneeded variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5765 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-23 20:21:36 +00:00
Benno Schulenberg 344fe558b6 Tidying up and renaming a variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5764 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-23 20:04:33 +00:00
Benno Schulenberg 6fc70cc474 Removing a pointless condition, and making use of an existing intermediary
variable for a little optimization.

Openfile can never be NULL -- it should have been called openbuffer, and
before we start fiddling with the cursor, we will always have an open buffer.
Edittop might be NULL, but that's okay.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5763 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-23 19:48:44 +00:00
Benno Schulenberg 3660c62bc0 Polling the keyboard once per second instead of once per two seconds.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5762 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-23 10:27:54 +00:00
Benno Schulenberg 4b2751c3b9 Cleaning up, improving comments, and renaming a variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5761 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-23 10:19:01 +00:00
Benno Schulenberg 8704dde873 Preventing the internal spell checker from finding the first occurrence of
a misspelled word twice.  And deleting the piece of dead code that was meant
to do this.  This fixes Savannah bug #47188.

When we've reached again the same line where we started and we find an
instance there, then this can only be /before or at/ the position from
where we started, otherwise we would have found it when we commenced
searching.  And so... that little piece of dead code does absolutely
nothing -- it will never fire.

It's so nice... nano is full of Easter Eggs!  :)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5760 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-23 09:52:34 +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 b55e8d7b34 Renaming four variables.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5758 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-21 20:49:29 +00:00
Benno Schulenberg 730b46c139 Trimming a duplicate variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5757 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-21 20:38:08 +00:00
Benno Schulenberg f150894d4e Factoring out the common part of do_search() and do_research()
into the new function go_looking().


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5756 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-20 16:57:15 +00:00
Benno Schulenberg b8a47f4e37 Not bothering to set 'answer'; just using 'last_search', which has already
been set to 'answer' in search_init() when 'answer' isn't empty, and when
'answer' /is/ empty we use 'last_search' anyway.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5755 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-20 16:19:30 +00:00
Benno Schulenberg b3b2fa8856 Using a 'return' instead of an 'else'.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5754 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-20 16:03:20 +00:00
Benno Schulenberg 4ddf194004 Always asking whether it's okay when the name of the file was changed.
This fixes Savannah bug #46894.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5753 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-20 14:34:46 +00:00
Benno Schulenberg 036c5f9c1f Cycling through the tab-completion items from newest to oldest.
This fixes Savannah bug #47205.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5752 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-20 13:38:09 +00:00