Commit Graph

434 Commits (17cf833b9c0631d933edcdd298099821c1634707)

Author SHA1 Message Date
Benno Schulenberg 17cf833b9c tweaks: normalize some whitespace 2016-05-30 09:09:36 +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 f7c3e1cac2 spelling: gettextize the next-word message 2016-05-18 10:25:16 +02:00
Benno Schulenberg cdcd365d34 tweaks: normalize some whitespace 2016-05-17 11:33:21 +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 0cc3da5d5e spelling: retreat one x position, to not miss the first word
This fixes https://savannah.gnu.org/bugs/?47932.
2016-05-16 12:31:34 +02:00
Benno Schulenberg 06b449b22c utils: provide a failure message for all uses of 'fsfromline' 2016-05-12 12:07:19 +02:00
Benno Schulenberg 21edf7bb90 tweaks: do an assignment in a more transparent way 2016-05-12 12:00:56 +02:00
Benno Schulenberg be4a3f8273 spelling: separate the fixing of different words with a short pause
When fixing a misspelling and not answering 'All' (but 'Yes' or 'No'),
the chance is quite substantial that one will type y or n at the end of
the next word.  Diminish this chance by showing for a moment a message
on the statusbar.
2016-05-04 19:45:09 +02:00
Benno Schulenberg 433c7e5dc6 spelling: don't partition the file for replacements in a marked region
Partitioning the file makes the undo system lose track, so that undoing
things has a good chance of losing data.  Instead, just make sure that
the region is marked "backwards", with current at the top and the mark
at the bottom, and then let the replace loop take care of not going
outside of the marked region.

This also has the effect that if the marked region fits entirely on the
screen, or all the misspellings are onscreen, then the screen will not
be scrolled at all.  Which makes for a smooth experience.

This fixes https://savannah.gnu.org/bugs/?47836,
and fixes https://savannah.gnu.org/bugs/?45573.
2016-05-04 19:45:09 +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 937c47898a spelling: pass the correct position of the cursor
When starting to replace misspelled words, pass the actual position
of the cursor instead of the position of the first found occurrence,
so that the cursor position will be updated for changed lengths.

This fixes https://savannah.gnu.org/bugs/?47834.
2016-05-03 13:07:40 +02:00
Benno Schulenberg 05238f31f4 search: elide an unneeded function
When we're spell checking, we don't need a special mechanism to detect
we have come full circle: reaching the end-of-buffer means we're done.
So don't bother to reset came_full_circle when we're spell checking
(when begin == NULL) but simply ignore its value.
2016-05-02 21:07:27 +02:00
Benno Schulenberg ae8df00b92 search: rename a variable and a function, for clarity and contrast 2016-05-01 12:59: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 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 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 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 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 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 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 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 e2b6572e9a Not putting cut words into the cutbuffer -- which means: treating the
deletion of words like the pressing of Backspace/Delete, so they don't
overwrite the lines you cut elsewhere and want to paste into the place
of the cut words.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5751 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-20 11:10:31 +00:00
Chris Allegretta 9f98333dce Call kill_spaces_on_justify justifytrim, to match the rest of rcfile naming conventions.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5679 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-25 21:04:45 +00:00
Chris Allegretta 16c037fdb0 Tweak KILL_TRAILING_SPACES. Still deciding on name...
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5675 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-24 04:46:44 +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 6a002f5196 Using the correct column number also when messages are skipped.
And not minding when the column number is zero or negative.
This partially fixes Savannah bug #47131.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5669 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 19:49:45 +00:00
Benno Schulenberg 7dd1030b15 Showing the cursor in the edit window when linting.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5668 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 18:34:04 +00:00
Benno Schulenberg e085ebb872 Making the cursor visible again after a justification and after an
unrecognized escape sequence.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5667 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 17:15:28 +00:00
Chris Allegretta 6a0ae5aaa2 2016-02-22 Chris Allegretta <chrisa@asty.org>
* Add ability to kill the trailing spaces when justifying
        code.  New nanorc option kill_spaces_on_wrap, we'll see
        whether this warrants a command line flahg or not.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5664 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 15:10:32 +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 56cfab3df6 Fixing Savannah bug #47127 the proper way,
eliding two silly calls of edit_redraw().


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5650 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-18 16:31:02 +00:00
Benno Schulenberg 15947ac871 Restoring the mentioned behavior also for the internal spell fixer.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5642 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-14 10:29:48 +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 de5b2634c8 Condensing some declarations, rewrapping some lines, and improving a
few comments.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5633 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-11 17:25:37 +00:00
Benno Schulenberg e39938c1fa Not leaving curses mode in the formatter, as that would hide
error messages upon reentry.  And, if there are any messages,
allowing the user a little time to read them.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5632 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-11 16:57:52 +00:00
Benno Schulenberg d4118efea5 Going to the next item in the list before freeing the current one.
This fixes Savannah bug #46796.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5631 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-11 08:50:11 +00:00
Benno Schulenberg ef2cfa31a7 Preventing a chain of editing actions from continuing after a discard.
This fixes Savannah bug #47104.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5623 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-10 08:49:23 +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 cca22bb10a Guiding the translators a little bit.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5607 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-05 12:27:54 +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