Commit Graph

679 Commits (b9f533a69e571e84958fa69699427de6f6672547)

Author SHA1 Message Date
Benno Schulenberg 5cdadc3eb1 tweaks: avoid an unused-variable warning when using --disable-comment 2017-05-19 11:55:37 +02:00
Benno Schulenberg 28beb3f9c5 replacing: don't let placewewant influence the placement of the cursor
When spotlighting the string to be replaced, placewewant isn't valid,
so tell place_the_cursor() to ignore its value to avoid the cursor
getting mistakenly placed at the beginning of the next row.

This fixes https://savannah.gnu.org/bugs/?50997.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
2017-05-11 22:28:34 +02:00
Benno Schulenberg 46430999d5 build: make --enable-help properly depend on --enable-multibuffer
And in the process transform the token DISABLE_HELP to ENABLE_HELP.
2017-04-25 18:27:55 +02:00
Benno Schulenberg 040bd93cc4 tweaks: distinguish (in the comments) between buffers and linestructs
Call something a buffer when it refers to a linked list of linestructs,
and call something a linestruct when it is a struct that describes a
single line.
2017-04-19 17:48:52 +02:00
Benno Schulenberg a43eee6aec tweaks: fix compilation with --enable-tiny --enable-color --enable-speller
Also avoid an unused-variable warning, and trim a useless assert.
2017-04-19 14:30:36 +02:00
Benno Schulenberg 74f128859b tweaks: rename a constant, to match the corresponding option 2017-04-17 11:51:48 +02:00
Benno Schulenberg 3dc6ccbe86 tweaks: rename a function, to be more accurate
Because nothing gets reset to zero or to some initial value.
2017-04-17 11:29:29 +02:00
Benno Schulenberg 2439e1e451 linting: treat a tab as one "column", not eight
This fixes https://savannah.gnu.org/bugs/?47131.
2017-04-10 20:32:36 +02:00
Benno Schulenberg dab70d06ed linting: when no is said to a file, remove all corresponding entries
When the user chooses not to open a file that some message refers to,
remove all messages for that file from the linting results, so the user
does not get asked about that same file again.

This fixes https://savannah.gnu.org/bugs/?47130.
2017-04-10 19:55:46 +02:00
Benno Schulenberg 754c62c5cc copyright: update the years, use ranges, and explain this usage
The interval 2013-2017 for the Free Software Foundation is valid
because in those years there were releases with changes by either
Chris or David, and the GNU maintainers guide advises to mention
a new year in all files of a package, not just in the ones that
actually changed, and be done with it for the rest of the year.
2017-04-09 12:09:23 +02:00
Benno Schulenberg 005ee8eda6 editing: avoid creating blank lines when using autoindent
When Enter is pressed while the cursor is exactly on the current
indent width, remove the blank characters on that line to avoid
creating a line that consists only of trailing whitespace.

(When Enter is pressed somewhere in the middle of the blanks,
however, the whitespace is preserved.)

Suggested-by: Florian Zeitz <florob@babelmonkeys.de>
2017-04-06 20:34:04 +02:00
Benno Schulenberg aedc3ddd49 tweaks: replace a function call or a macro with a hard number
Verify at startup that the number is not too small.
2017-04-04 19:17:02 +02:00
Benno Schulenberg 53cea142e0 tweaks: use memory on the stack instead of calling malloc() and free()
Rename some variables in the process, and remove two cluttering asserts.
2017-04-04 19:14:14 +02:00
Benno Schulenberg 582a624998 tweaks: frob some parentheses and other things, to be more consistent 2017-03-29 19:30:37 +02:00
David Lawrence Ramsey c888edf409 softwrap: save and restore firstcolumn when internally spell-fixing text
In do_int_spell_fix(), spell-checking text may change firstcolumn if
the next match is offscreen, and spell-checking text after that will
not change it back.  In order to keep the viewport unchanged, we have
to save and restore not just edittop, but firstcolumn as well.
2017-03-22 10:44:06 +01:00
David Lawrence Ramsey 7cd50b8c02 softwrap: save firstcolumn when justifying, restore it when unjustifying
In do_justify(), justifying text may change firstcolumn if the paragraph
ends offscreen, and unjustifying the text again will not change it back.
In order to keep the viewport unchanged, we have to save and restore not
just edittop, but firstcolumn as well.
2017-03-22 10:44:06 +01:00
David Lawrence Ramsey 80b3a3011b weeding: remove ensure_line_is_visible()
Since all lines can be partially scrolled off the screen now
(except for the top line of the edit window, which is forthcoming),
ensure_line_is_visible() is no longer needed.
2017-03-22 10:44:05 +01:00
Benno Schulenberg d42f71a2ef tweaks: avoid a few needless reallocations
Most of these variables are freed moments later -- reallocating
them is thus a waste of time.
2017-03-20 13:07:57 +01:00
Mike Frysinger 3deec4352b assume regex.h support is always available
Now that we pull in the gnulib regex module, we can assume it exists.
2017-03-06 12:01:08 +01:00
Benno Schulenberg 0af5788a94 tweaks: reduce the scope of five variables, and frob some comments 2017-03-01 09:56:38 +01:00
Benno Schulenberg d5b950cc29 tweaks: don't turn the mark off before it's needed
The mark only needs to be off when calling replace_marked_buffer(),
because this indirectly calls ingraft_buffer(), which fiddles with
the end points if the mark is on.
2017-03-01 09:35:45 +01:00
Benno Schulenberg adf69a05f1 spelling: keep the cursor at end-of-line if it was there
This fixes https://savannah.gnu.org/bugs/?50415.
2017-02-28 20:45:49 +01:00
David Lawrence Ramsey 29681e0e9f weeding: remove partitioning and related stuff from do_justify()
Replace partitioning with calls to extract_buffer() and ingraft_buffer().

In addition to pasting the unjustified text back into the buffer at
current[current_x], ingraft_buffer() also deals with renumbering and
updating totsize, so do_justify() doesn't need to do those anymore
when unjustifying.
2017-02-28 14:35:44 +01:00
David Lawrence Ramsey 234bd9c9be speller: fix replacing marked text in the alternate spell checker
With read_file() revamped, it now uses partition_filestruct() indirectly
via ingraft_buffer(), so we can't use partition_filestruct() to replace
marked text in the alternate spell checker anymore without segfaulting.

Add the new function replace_marked_buffer() to accomplish this instead.
Based on replace_buffer(), it uses extract_buffer() to throw away the
marked un-spell-checked text, and then uses read_file() to insert the
spell-checked text at the position where the mark was.

Accordingly, remove unneeded partitioning and related stuff from
do_alt_speller().  Besides pasting the file into the buffer at
current[current_x], ingraft_buffer() also deals with renumbering,
updating totsize, and handling a magicline, so do_alt_speller()
doesn't need to do those anymore.
2017-02-28 14:35:44 +01:00
David Lawrence Ramsey 0d9313763d undo: fix undoing/redoing insertions, since they no longer do partitioning 2017-02-28 14:35:44 +01:00
Benno Schulenberg e5731fe198 tweaks: reshuffle three statements, and shorten a comment 2017-02-25 12:33:01 +01:00
Benno Schulenberg 2bbb6cfeb5 wrapping: add the correct char length when skipping consecutive blanks
In this last loop of break_line(), the pointer 'line' is one step ahead
of the index 'lastblank'.  So the loop should first add the length of
the preceding character to 'lastblank' before determining the length
of the current character (and using this to advance 'line').
2017-02-25 11:18:24 +01:00
Benno Schulenberg 1623bc7779 tweaks: rename three variables, to better distinguish bytes from columns
(There is something wrong in the last loop: line is one character ahead
of lastblank, but the current character length is added to both of them.
It thus assumes that all blank characters are the same number of bytes.
For spaces and tabs this works fine.  But for more exotic blanks...)
2017-02-24 22:08:55 +01:00
Benno Schulenberg 99ecd33c18 tweaks: elide two variables, and condense some statements
Also, remove an assert and adjust some comments.
2017-02-24 21:11:37 +01:00
David Lawrence Ramsey 6500f769aa tweaks: move comments outside of if blocks in break_line() 2017-02-24 21:04:31 +01:00
David Lawrence Ramsey f95836a951 tweaks: remove cluttering #ifdefs from break_line()
Also, rename a parameter to be less cryptic, and remove an entire
condition because the relevant block will never be reached when
getting called from the help routines: if blank_loc is negative,
the function will have bailed out in the preceding if.
2017-02-24 17:33:39 +01:00
Benno Schulenberg 07ebba5e99 tweaks: rename a variable and invert its logic 2017-02-24 12:21:59 +01:00
Benno Schulenberg de3260cdb1 justify: reduce the character count when trimming trailing spaces
This fixes https://savannah.gnu.org/bugs/?50379.
2017-02-22 17:29:39 +01:00
David Lawrence Ramsey 1cb945fe8e tweaks: rename the functions for moving to and copying from a buffer
The name "filestruct" was a mistake.  What was meant was:
buffer -- a linked list of structs that each describe a line.
2017-02-17 20:06:32 +01:00
Benno Schulenberg d60e7d374c spelling: correctly adjust the length of a single-line region
When the marked region covers only a single line (or a part of it),
its new endpoint is not simply the length of the last line of the
spell-checked text, but instead the old endpoint plus the /change/
in length.

This fixes https://savannah.gnu.org/bugs/?50316.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
2017-02-16 11:52:24 +01:00
Benno Schulenberg 914af36546 spelling: don't unnecessarily fiddle with the viewport
If we're somewhere deep into the file and do a spell check, and the
first misspelled word happens to be right there, onscreen already,
then this word does not need to be centered -- it /should/ not be
centered.  We should scroll only when necessary.
2017-02-10 22:09:03 +01:00
Benno Schulenberg 8f10e364bb replacing: stop searching in a region when edge of buffer is reached
Just like when spell-checking, there is no need to wrap around when
doing replacements in a region, because a region cannot straddle the
buffer's edges.

This is the proper fix for https://savannah.gnu.org/bugs/?50158,
and fixes https://savannah.gnu.org/bugs/?50273.
2017-02-10 13:51:51 +01:00
David Lawrence Ramsey 83ff644b6a tweaks: do a comparison a bit differently in do_output() and do_deletion()
Make it clearer we're comparing the number of rows, not string lengths.
2017-02-05 12:30:09 +01:00
Benno Schulenberg 94e563232e general: stop the spell checker from crashing after the changes in search
The spell fixer does not provide a beginning line, so the search routine
should then not try to refer to any data of this line.  Also, since the
changes to the search routine there is no need any more to retreat one
step before starting to search for a misspelled word.

This fixes https://savannah.gnu.org/bugs/?50159.
2017-01-26 20:21:41 +01:00
Benno Schulenberg ef7a7c5360 replacing: ignore the first match when the user said no
When the user answered No to a replacement prompt, skip the match
at the current position, so we don't stay stuck there.

Also, when replacing in the backward direction, or the match is
of length zero, skip the match at the current position, to not
get stuck.

This fixes https://savannah.gnu.org/bugs/?50126.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>

This also fixes https://savannah.gnu.org/bugs/?50137,
and refixes https://savannah.gnu.org/bugs/?48635,
and fixes https://savannah.gnu.org/bugs/?50144.
2017-01-26 17:41:49 +01:00
Benno Schulenberg c0aa5ad258 tweaks: miscellaneous frobbings 2017-01-09 18:25:25 +01:00
Benno Schulenberg 322120c980 undo: properly create separate items for deletes at different positions
That is: only extend the current Del or Backspace undo item when the
cursor is still (or again) at the same spot.

This fixes https://savannah.gnu.org/bugs/?50006.
2017-01-08 11:05:52 +01:00
Benno Schulenberg fd0589d8bc tweaks: remove the cluttering conditional compilation of a parameter
The conditionalizing saved negligible amounts of space, of memory, and
of speed.
2017-01-03 14:11:45 +01:00
Benno Schulenberg a381021ffc tweaks: when allow_tabs is FALSE, allow_files is irrelevant
In that case setting the latter to TRUE is misleading.  So don't do that.
2017-01-03 14:02:52 +01:00
David Lawrence Ramsey b1c20629f5 weeding: remove unnecessary settings of openfile->current_y
Many of the adjustments of the value of openfile->current_y appear to be
a holdover from the days when certain functions had to account for what
is now called STATIONARY scrolling mode, which depends on the value of
current_y.  Remove these adjustement where they are superfluous.

do_para_begin(), do_para_end(), and do_bracket_match() update the screen
through edit_redraw(), which uses either CENTERING or FLOWING scrolling
mode, so their setting of current_y is redundant and useless, as it will
be ignored and then overridden by the next call to reset_cursor().

findnextstr() is called by go_looking() [which calls edit_redraw(), see
above], and by do_replace_loop() and do_int_spell_fix(), which both call
edit_refresh(), which in this case only uses CENTERING scrolling mode
since focusing is TRUE.

(Additionally, the adjustments of current_y in findnextstr() and
do_bracket_match() use incorrect values when in softwrap mode.)

find_paragraph() doesn't need to save or restore current_y, because it
doesn't do any screen updates.  do_justify() calls edit_refresh() with
focusing set to TRUE, so it uses the CENTERING scrolling mode.

do_alt_speller() and do_formatter() do not need to save and restore
current_y, because they don't modify it in any way.

This addresses https://savannah.gnu.org/patch/?9197.
2017-01-02 12:40:21 +01:00
Benno Schulenberg 7373e4cd46 tweaks: fix compilation when configured with --disable-wrapping 2017-01-01 16:33:40 +01:00
Benno Schulenberg d3429a7a57 copy: properly set preferred x position when region was marked backwards
This fixes https://savannah.gnu.org/bugs/?49964.
2016-12-31 16:36:14 +01:00
Felix Janda fc89ac11d2 speller: fix build when tiny build is enabled
URL: https://bugs.gentoo.org/604000
2016-12-29 13:43:06 -05:00
Benno Schulenberg 588daf949e tweaks: condense the setting of three flags 2016-12-25 13:11:17 +01:00
Benno Schulenberg d21a9c8fc3 text: discard the undo stack after formatting and after spell checking
After a call to the Formatter or the Alternate spell checker, the data
on the undo stack could refer to line positions that don't exist any
more -- the chance is small, but it is there.  So... throw the whole
undo stack away, to prevent undoing things wrongly or even crashing.

(Changes made with the internal spell checker can be undone and redone
without a problem -- nano keeps full track of those.  But the changes
made with a formatter or an external spell checker happen in another
process, so nano has no record of them.)

This fixes https://savannah.gnu.org/bugs/?49920.
2016-12-24 12:22:50 +01:00
Benno Schulenberg edbc1e5950 text: avoid a crash when a spell-checked line has gotten shorter
When using an external spell checker or formatter, the line with
the cursor might become shorter, which might result in the stored
cursor position being beyond the end-of-line.  So, when restoring
the x position, make sure to limit it to the length of the line.

This fixes https://savannah.gnu.org/bugs/?49923.
2016-12-24 12:22:17 +01:00
Benno Schulenberg 6620acbff4 tweaks: use a faster comparison 2016-12-20 10:03:53 +01:00
Benno Schulenberg 1cb6619d6a undo: there are just two forms of deletion: backspacing and deleting
A third method does not exist.
2016-12-19 21:18:43 +01:00
Benno Schulenberg 79a4bf81dc tweaks: rename five variables, for uniformity with a few others 2016-12-19 19:58:15 +01:00
Benno Schulenberg 9fa95a3680 tweaks: put some prototypes in the proper order, and move a bit of code 2016-12-15 13:04:52 +01:00
Benno Schulenberg ea9f62fc0f tweaks: adjust some comments and indentation and ordering 2016-12-13 19:27:33 +01:00
Benno Schulenberg 13ec5d8ce9 spelling: correctly restore the selected region
An added magic linefeed should be removed again /before/ restoring
the x position, as the latter needs to be calculated from the real
last line of the region.

This fixes https://savannah.gnu.org/bugs/?49817.
Reported-by: Mike Frysinger <vapier@gentoo.org>
2016-12-11 09:55:38 +01:00
Benno Schulenberg 173bbe11ef tweaks: add a few translator hints 2016-12-07 21:05:41 +01:00
Benno Schulenberg 7531b71fa1 docs: note Sumedh as the author of the word-completion feature 2016-12-07 21:05:23 +01:00
Benno Schulenberg 964c10db17 tweaks: miscellaneous frobbings and rewrappings 2016-12-07 20:37:08 +01:00
Benno Schulenberg 68a0314500 build: add configure option --disable-wordcomp to disable word completion
(The variable 'pletion_line' is not conditionalized with this option, as
it would become messy.  The compiler will probably be able to elide it.)

When using --enable-tiny, it is not possible to use --enable-wordcomp,
because the word completion function uses the undo system.
2016-12-07 17:02:25 +01:00
Sumedh Pendurkar dca4ab5d8f new feature: complete a fragment to a longer word found in the buffer
Executing the 'complete_a_word' function will search from the start
of the current buffer for entire words that begin with the fragment
that is before the cursor, and will complete this fragment to the
first word that is found.  Each consecutive call of 'complete_a_word'
will search for the next matching word and will complete the fragment
to that.  By default the function is bound to the ^] keystroke.

Signed-off-by: Sumedh Pendurkar <sumedh.pendurkar@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-12-07 16:42:39 +01:00
Benno Schulenberg 86121cf3fc tweaks: move a cursor-on switch to a more logical place (again)
But do it correctly this time: don't switch it on when replacing.
2016-12-05 15:47:44 +01:00
Benno Schulenberg f920e0d30c tweaks: replace some unneeded direct calls of edit_refresh() 2016-12-03 17:00:28 +01:00
Benno Schulenberg 0f3e303d1a tweaks: get rid of some spurious textual references to edit_refresh() 2016-12-02 18:13:10 +01:00
Benno Schulenberg e4b8d6fab5 tweaks: remove a bit of obscuring conditional compilation 2016-11-30 11:46:05 +01:00
Benno Schulenberg 7598b77e75 screen: use the correct width to determine whether a softwrap occurred
This fixes the two bugs reported by Anton Minaev
in https://savannah.gnu.org/bugs/?49511.
2016-11-13 19:20:38 +01:00
Benno Schulenberg 2cd8ca4eb1 tweaks: stop compiling the whole_word_only parameter conditionally
This make tiny nano slightly less tiny, but makes the code more readable.
2016-10-23 20:07:30 +02:00
Benno Schulenberg 01bbf7e82f tweaks: rename a function to better describe what it does
It does not update anything -- it just picks a new point from
where to start displaying the buffer.  All actual updating of
the screen is done by edit_refresh() and edit_redraw() and such.
2016-10-23 17:26:19 +02:00
Benno Schulenberg 43f35fc7a9 softwrap: ensure the current line is fully visible when moving in it
This fixes https://savannah.gnu.org/bugs/?49099,
and fixes the unreported corresponding bugs for
<End> and <Del> and typing extra characters.
2016-10-18 15:07:47 +02:00
Benno Schulenberg 3264d0c5be tweaks: move a variable that doesn't need to be global 2016-10-12 19:59:26 +02:00
Benno Schulenberg d9148e7b3f tweaks: elide an unneeded variable 2016-10-12 19:20:39 +02:00
Benno Schulenberg 08cd197bf1 general: include word-jumping and block-jumping into the tiny version
And also case-sensitive searches, backward searches, and searching again.
2016-09-13 09:27:04 +02:00
Benno Schulenberg 514cd9a099 update the license text to the preferred version
Mentioning "GNU nano" instead of "This program" and referring to the
website instead of to a postal address.
2016-08-29 21:27:16 +02:00
Benno Schulenberg 406e5242a3 update the copyright notices 2016-08-29 21:27:05 +02:00
Benno Schulenberg 382c9d792d new feature: allow text selection by holding Shift with the cursor keys
Add the keycodes and routines to allow the user to forego setting the
mark explicitly (with M-A / ^6) and instead quickly select a few words
or lines by holding down Shift together with the movement keys.

(Some combinations with Shift are swallowed by some terminal emulators.
To work around some of those, the combinations Shift+Alt+Left/Right work
as Shift+Home/End and Shift+Alt+Up/Down work as Shift+PageUp/PageDown.)
2016-08-28 11:29:28 +02:00
Benno Schulenberg d8031af030 screen: retain the placewewant also when using an alternate speller
When using the default speller or the formatter, the placewewant is
remembered.  So it should be remembered too when the user specifies
a different speller.

(This behavior was inadvertently lost last year, in commit 82d737e.)
2016-08-12 20:02:04 +02:00
Benno Schulenberg 14ac47517b spelling: don't abort when a misspelled word isn't found, just note it
This fixes https://savannah.gnu.org/bugs/?48660 doubly, in case there
are other ways in which 'spell' sees words differently from 'nano'.
2016-08-03 12:55:21 +02:00
Benno Schulenberg 91951ab22a input: don't bother putting a keycode into byte range
A keycode is either already in byte range (so there is nothing to do)
or it is not and it shouldn't be (so there is nothing to do either).
2016-07-30 12:19:47 +02:00
Benno Schulenberg 24b10179a1 files: beep whenever writing out a file fails
Just like when reading a file fails.  It needs the user's attention.
2016-06-27 19:17:53 +02:00
Benno Schulenberg 68acc1dfc5 tabs: compute the number of required spaces without iterating 2016-06-24 14:56:41 +02:00
Benno Schulenberg 79e3eaf73c linter: refresh the edit window in order to actually place the cursor
This fixes https://savannah.gnu.org/bugs/?48283.
2016-06-21 16:25:07 +02:00
Benno Schulenberg 9106cc8ecc main: let the main loop restore the main menu, if needed
Don't make it the responsibility of the executed functions to restore
the list of shortcuts of the edit window.  Just detect whether another
menu was displayed, and if so, redisplay the main menu.
2016-06-21 11:03:38 +02:00
Benno Schulenberg 95f417fa9a tweaks: rewrap a bunch of lines and some comments 2016-06-20 13:05:45 +02:00
Benno Schulenberg 158388c5a6 justify: enable cursor display also for the first keystroke afterward
This fixes https://savannah.gnu.org/bugs/?48246.
2016-06-16 20:40:09 +02:00
Benno Schulenberg 883373cd76 undo: start renumbering from the head of the paste, not from its tail
Because when undoing a paste at the end of the buffer, the tail line
probably does not exist any more.

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

(It would have been the proper fix for
https://savannah.gnu.org/bugs/?44488.)
2016-06-14 16:34:29 +02:00
Benno Schulenberg d87c357abe tweaks: remove two redundant assignments
The mark has already been unset by do_cut_text().  And any assignment
to 'mark_begin' is useless when 'mark_set' is FALSE.
2016-06-07 19:53:27 +02:00
Benno Schulenberg ccffc548e1 text: after undoing or redoing something, unset the mark
This fixes https://savannah.gnu.org/bugs/?48108,
and fixes https://savannah.gnu.org/bugs/?48157.
2016-06-07 19:52:23 +02:00
Benno Schulenberg 83b89a49ef text: remove a redundant undo element
Implement its single use case by making better use of another element.
2016-06-07 19:23:51 +02:00
Benno Schulenberg 87a254400e text: remove a pointless setting of an undo element; it is never used 2016-06-07 19:23:51 +02:00
Benno Schulenberg 9192b7fe8c text: add an undo item before starting to comment or uncomment lines
By moving the test for the only situation where do_comment() does nothing
(when only the magic line is selected) further up front, the add_undo()
can be called before the commenting/uncommenting starts and two variables
and an extra function are made unnecessary.
2016-06-07 11:08:06 +02:00
Benno Schulenberg f0c65bc988 tweaks: add come comments and rename a variable 2016-06-06 20:29:53 +02:00
Benno Schulenberg 5f4d759679 tweaks: fix compilation when configured with --enable-tiny
Reported-by: Mike Scalora <mike@scalora.org>
2016-06-06 19:57:51 +02:00
Benno Schulenberg edf230b7df text: store the new file size in the undo item also when joining lines
This fixes https://savannah.gnu.org/bugs/?48099 reported by Mike Scalora.
2016-06-04 11:39:59 +02:00
Mike Scalora 115aeda69b text: keep the file size correct when undoing/redoing a comment/uncomment
Store the file sizes from before and after the commenting/uncommenting
in the undo struct, so they can be restored when undoing or redoing.

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

Signed-off-by: Mike Scalora <mike@scalora.org>
2016-05-31 21:36:22 +02:00
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
Benno Schulenberg 9d72efa474 Gettextizing a forgotten string.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5534 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-04 11:10:07 +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 0dd351a5c1 Condensing the exit code of do_linter().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5531 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-04 10:05:52 +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 97e9476df5 Skipping the unneeded reinitialization of the windows;
it will be done when polling the keybuffer.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5521 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-02 16:25:50 +00:00
Benno Schulenberg 9eca195990 Plugging three tiny memory leaks.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5520 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-02 16:01:04 +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 33bc96ab5c Restoring the cursor position differently, using a more basic routine.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5516 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-31 16:44:32 +00:00
Benno Schulenberg 9a6f62ff67 Rewrapping and reordering a few lines.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5493 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-08 19:09:14 +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
Benno Schulenberg 40e1fd37d7 Fixing compilation with --enable-tiny --enable-justify.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5479 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-05 10:16: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 4bc8ff1e6d Discarding the entire undo stack, to prevent nano from making mistakes
when trying to undo edits after an indentation change.
This works around Savannah bug #46591.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5474 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-03 09:17:06 +00:00
Benno Schulenberg 8651fefc68 Discarding the entire undo stack, to prevent nano from dying (or
making mistakes) when trying to undo edits after a justification.
This works around Savannah bug #45531.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5473 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-03 09:03:45 +00:00
Benno Schulenberg ee5cdcbce5 Moving the trimming of the undo stack into a separate function.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5472 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-03 08:50:34 +00:00
Benno Schulenberg 6fa1e98c8d Ehm... that was a silly, superfluous condition.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5469 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-02 19:11:03 +00:00
Benno Schulenberg 1fbcf0b23d Accepting not just 'Uncut' but also 'Undo' for undoing a justification.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5468 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-02 19:03:34 +00:00
Benno Schulenberg ae22fe03eb Deleting two redundant assignments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5460 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-01 11:51:10 +00:00
Benno Schulenberg 66e21416af Storing and retrieving the correct file size before and after an action.
This fixes Savannah bug #45523.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5456 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-30 16:21:51 +00:00
Benno Schulenberg 6b1566023a Redoing cuts at EOF properly.
This fixes Savannah bug #46541.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5455 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-30 15:49:37 +00:00
Benno Schulenberg 4a59b12ed4 Warning about an impossible condition, instead of blithely continuing.
And eliding an unneeded variable.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5445 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-26 09:31:33 +00:00
Benno Schulenberg 793d8490de Also the /redoing/ of a Backspace at EOF is a special case.
This fixes Savannah bug #46532.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5444 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-26 08:45:22 +00:00
Benno Schulenberg 530c7862c9 Handling more internal errors, and doing it correctly: showing it
directly on the statusbar instead of as an undid or redid message.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5442 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-25 10:11:54 +00:00
Benno Schulenberg b255b01b50 Eliding an unneeded variable, and not skipping the end of the function
when things went wrong.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5441 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-25 09:49:27 +00:00
Benno Schulenberg 1b69dd629a Warning about a condition that should never occur,
instead of silently continuing.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5440 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-25 09:27:25 +00:00
Benno Schulenberg fbe4376822 Inserting a new node into a linked list by using just two parameters:
the insertion point and the new node.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5437 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-24 13:24:01 +00:00
Benno Schulenberg 72caa54020 Deleting a node right after unlinking it.
This now mirrors unlink_opennode() and delete_opennode().


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5433 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-22 16:14:42 +00:00
Benno Schulenberg 81f3177a33 Eliding an unneeded variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5432 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-22 16:09:15 +00:00
Benno Schulenberg 6007d6227b Rewrapping, rewriting, renaming, and reordering some things.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5431 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-22 16:08:28 +00:00
Benno Schulenberg d6bd276c8c Deleting a condition that will never occur.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5430 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-22 16:07:23 +00:00
Benno Schulenberg f9274a5a29 Deleting an unneeded variable alias.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5405 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-12 19:50:33 +00:00
Benno Schulenberg ec26fd5e7c Storing the correct end position of an inserted file,
and using it for an undo and redo.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5404 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-12 19:01:57 +00:00
Benno Schulenberg bde996db67 Discarding a now useless function.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5403 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-11 19:56:35 +00:00
Benno Schulenberg 7be493047c Oops! Blackout!
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5402 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-11 19:15:36 +00:00
Benno Schulenberg 54c2f6b5ae Chopping the now unused parameter 'undoing'.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5401 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-11 19:04:31 +00:00
Benno Schulenberg f1d9fcc77b Redoing an Enter from stored undo data, instead of running do_enter() again,
because the latter behaves differently depending on the setting of autoindent.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5400 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-11 18:51:39 +00:00
Benno Schulenberg b66e4bfa5b Deleting a redundant assignment.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5394 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-06 21:02:50 +00:00
Benno Schulenberg 452066bc88 Chopping the 'undoing' parameter, so that the calls of do_cut_text() become
more symmetrical: wrapped in add_undo() + update_undo() where needed.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5390 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-02 13:46:40 +00:00
Benno Schulenberg d0e8887e3b Eliding two variables.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5389 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-02 11:24:22 +00:00
Benno Schulenberg 499c2af385 Removing an 'if' that will never be true, and removing some
assignments that have already been done.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5381 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-29 17:27:33 +00:00
Benno Schulenberg bf64514283 Checking for "nothing to redo" earlier, in order to restore the
possible warning about an internal error.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5380 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-29 17:02:13 +00:00
Benno Schulenberg b0a2f9853b Skipping the addition of an undo only when the current action equals the
last action.  Necessary for when typing text is broken by an undo+redo.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5379 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-29 16:52:42 +00:00
Benno Schulenberg d0b72552bf Oops! You can't swap those two conditions.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5377 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-29 09:04:30 +00:00
Benno Schulenberg 26eed9d406 Removing a condition that can never occur.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5376 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-28 20:49:16 +00:00
Benno Schulenberg 3059e16c25 Spoofing a line number for the redoing of an INSERT, because
'u->mark_begin_lineno' is being used as the length of the insertion.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5375 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-10-28 20:24:15 +00:00
Benno Schulenberg b3e4051ded Adding two new bindable functions which delete all characters
from the cursor to the preceding or succeeding word start.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5334 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-31 11:52:26 +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 e4294a211e It is better to say that this function is disabled
than that no linter has been defined.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5326 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-29 17:36:39 +00:00
Benno Schulenberg 0b15c42a5c Dropping two superfluous checks for restricted mode, and
two superfluous checks for the definition of a formatter.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5325 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-28 20:04:18 +00:00
Benno Schulenberg bff6a905af Reenabling SIGWINCH-es also when invocation of the formatter fails,
and correcting some comments.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5324 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-28 19:39:34 +00:00
Benno Schulenberg 74e7521478 Adjusting some comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5308 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-18 10:32:01 +00:00
Benno Schulenberg 6039cd7f6e Avoiding an unfounded warning about a possibly uninitialized variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5306 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-17 21:11:32 +00:00
Benno Schulenberg 42f307ef75 (Putting in the original patch, from before I got overzealous.)
Removing an unneeded condition -- 'added_magicline' can only be
true when NO_NEWLINES isn't.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5297 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-13 17:57:58 +00:00