Commit Graph

1404 Commits (b97da1dfe41ad2fc8396fb038d300f4d9b7594df)

Author SHA1 Message Date
Benno Schulenberg 40053593a8 general: rename "bookmark" to "anchor", to sound less permanent 2020-04-13 11:25:29 +02:00
Benno Schulenberg 732cf88786 text: retain a bookmark when two lines are joined or something is cut
Also, do not copy the bookmark into the cutbuffer, so it will not get
pasted elsewhere.
2020-04-13 11:10:23 +02:00
Marco Diego Aurélio Mesquita 9fb0beca1d bindings: hard-bind the bookmark functions to M-Ins and M-PgUp/M-PgDn
Bind the toggling of a bookmark to <Alt+Insert>, and the jumping to the
previous and next bookmark to <Alt+PageUp> and <Alt+PageDown>, so that
these functions are available by default.

Signed-off-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
2020-04-13 10:51:40 +02:00
Marco Diego Aurélio Mesquita f091c34bac new feature: bindable functions for toggling and jumping to "bookmarks"
With the 'bookmark' function, the user can place a bookmark on any
line in the buffer.  Multiple lines can be bookmarked in this way.
With 'prevbookmark' and 'nextbookmark', the user can then easily
return to the bookmarked lines.  The search for a bookmark wraps
around, as if start and end of buffer are connected.

[However, in this implementation, when a bookmarked line is deleted,
the bookmark is deleted too.  This is undesirable.  Also, when such
a deleted line is pasted elsewhere, the bookmark reappears with it,
and when pasted multiple times, the bookmark will be there as many
times.  This is thoroughly undesirable.  These behaviors will be
changed in a later commit.]

A bookmark is not yet visible in any way.

This fulfills https://savannah.gnu.org/bugs/?57577.
Requested-by: Ken Tyler <kent@werple.net.au>

Signed-off-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2020-04-13 10:51:40 +02:00
Benno Schulenberg f4a33b868a tweaks: delete the now-unused partitioning and unpartitioning routines 2020-04-09 12:12:04 +02:00
Benno Schulenberg 9f1c3c8513 memory: plug a leak, by freeing the cutbuffer after a bracketed paste
Also, remove an unneeded assignment -- the 'cutbottom' variable is
needed only when consecutives cuts (^K) or copies (M-6) are made.
2020-03-30 16:55:38 +02:00
Benno Schulenberg 7d3aad403d options: make -S the short synonym of --softwrap
The form -$ is still accepted, but is deprecated.
2020-03-27 17:02:55 +01:00
Benno Schulenberg aa70f3d95e options: stop recognizing the obsolete --morespace and --smooth
They have been no-ops for a year.

Also remove their documentation entries.

(The nanorc options still remain -- to be removed next year.)
2020-03-27 16:54:09 +01:00
Benno Schulenberg ba25d0df1d tweaks: fix twenty typos, in old Changelogs and in some comments
They were found by a run of 'codespell' at https://fossies.org/.

Reported-by: Jens Schleusener <Jens.Schleusener@fossies.org>
2020-03-25 16:57:43 +01:00
Benno Schulenberg 481529e865 input: accommodate silly emulators that have LF instead of CR in a paste
Even though a user would never type ^J to start a new line, accept it
as a synonym of <Enter> (^M) in a bracketed paste, because apparently
bash accepts it as a synonym too.

This works around https://savannah.gnu.org/bugs/?58010.
2020-03-20 14:25:27 +01:00
Benno Schulenberg 4ce2e146ea tweaks: elide three unneeded #defines
Backspace and Tab and Carriage Return have standard backslash escapes.
2020-03-19 14:40:51 +01:00
Benno Schulenberg ea95ad24be usage: improve the description of --softwrap
Concisely say what the option actually does.
2020-03-17 09:51:03 +01:00
Benno Schulenberg 02efc760bf tweaks: rename a symbol, to match the corresponding renamed option 2020-03-13 16:17:10 +01:00
Benno Schulenberg 9a59cddcd4 options: rename --suspend to --suspendable, to make more sense 2020-03-13 15:54:24 +01:00
Benno Schulenberg ebf9279f95 tweaks: rename two more functions, to match the style of others 2020-03-11 19:47:21 +01:00
Benno Schulenberg 304548ef82 tweaks: rename two functions, to match the style of others 2020-03-11 19:45:06 +01:00
Benno Schulenberg dd6f129c3c tweaks: rename two functions, for shortness 2020-03-11 19:43:03 +01:00
Benno Schulenberg 750b51c343 copyright: update to the current year for significantly changed files 2020-03-11 11:52:15 +01:00
Benno Schulenberg 843dbd56ef tweaks: rename two more elements of an undo record, for symmetry
(Note that for a PASTE and a COUPLE_END the variables seem to be used
the wrong way around.  Maybe this can be improved.)
2020-02-27 10:08:48 +01:00
Benno Schulenberg be7e000389 tweaks: pull the NUL-terminating of a string into a function
Also, avoid copying one byte too many that afterward gets
overwritten with '\0'.
2020-02-20 17:08:32 +01:00
Benno Schulenberg 76f1a4af4f tweaks: add a different helping variable 2020-02-19 19:06:04 +01:00
Benno Schulenberg bb1a0bd86c input: after reallocating a string, do not write to its old address
The old address has become invalid, and probably does not have enough
room for the write, thus causing a crash.

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

Bug existed since commit 8625609c from two days ago.
2020-02-19 18:54:01 +01:00
Benno Schulenberg 8b2b9654ab tweaks: condense a comment, reshuffle conditions, and remove unwanted one 2020-02-18 16:26:56 +01:00
Benno Schulenberg 60ae71bf3a softwrap: when typing goes beyond the bottom row, scroll just one row
This fixes https://savannah.gnu.org/bugs/?57851.

Bug existed since version 2.8.0, when scrolling per soft-wrapped chunk
was made possible.
2020-02-18 15:42:20 +01:00
Benno Schulenberg 8625609c2d tweaks: rename a variable, and add a helping one 2020-02-18 15:00:27 +01:00
Benno Schulenberg 3c4a4b04ce tweaks: normalize the indentation after the previous change
Also rewrap two lines, reshuffle three, and improve three comments.
2020-02-18 14:58:06 +01:00
Benno Schulenberg b3faf353c9 tweaks: inject the entire burst of bytes at once into the edit buffer
Not doing it characterwise saves a reallocation, a memmove(), several
checks, and an update_undo() for each character over one.

This has been tested by temporarily setting 'bracketed_paste = FALSE'
instead of 'bracketed_paste = TRUE' in convert_sequence() in winio.c,
and then pasting stuff into nano.
2020-02-18 14:54:19 +01:00
Benno Schulenberg f700b422be tweaks: call add_undo() before the character is actually added
And before the buffer size is adjusted, so that the add_undo()
doesn't need to correct the stored former size of the buffer.

This will allow the injection of multiple characters at once,
in the next commit.
2020-02-18 14:40:15 +01:00
Benno Schulenberg 5c07a747bb tweaks: adjust some whitespace, reshuffle two ifs, and remove two braces 2020-02-17 11:29:13 +01:00
Benno Schulenberg 75f4309c1f tweaks: rename four parameters, to be more distinct and telling 2020-02-13 14:22:40 +01:00
Benno Schulenberg 78767b583d tweaks: elide an intermediate copy of a character during injection, twice 2020-02-13 14:22:23 +01:00
Benno Schulenberg 61dc2cab0b tweaks: rename two variables, and frob four comments 2020-02-12 16:20:20 +01:00
Benno Schulenberg 070ccf4a5b tweaks: rename two variables, and reshuffle a few things 2020-02-12 14:28:07 +01:00
Benno Schulenberg 8e4b68917c tweaks: rename a function, and condense a few comments 2020-02-12 14:15:35 +01:00
Benno Schulenberg 0d0d011579 tweaks: combine two ifs into one 2020-02-12 12:09:12 +01:00
Benno Schulenberg 71daa1ef6b tweaks: update several comments after the previous changes 2020-02-12 12:05:52 +01:00
Benno Schulenberg 0ed62e84de tweaks: weld two fragments together, twice, by eliding an unneeded 'if'
The get_kbinput() routine will never return ERR, so there is no need
to check for that.
2020-02-12 11:46:15 +01:00
Benno Schulenberg 0a31a9aa38 tweaks: make two conditions more direct, and thus elide two functions
Using straightforward comparisons is clearer and faster and shorter.

Again, note that this does not filter out 0x7F (DEL).  But that is
okay, as that code will never be returned from get_kbinput().
2020-02-12 11:38:33 +01:00
Benno Schulenberg 6747142cd7 tweaks: remove some redundant filtering, and thus elide a parameter
The few calls of the injection routines that had 'filtering' set to
TRUE have already filtered out ASCII control codes earlier on.  And
in the case of injecting a completion, this completion only contains
word-forming characters -- and if the user somehow added a control
code to the word-forming characters, then nano should NOT filter it
out, so in fact that setting of 'filtering' to TRUE was mistaken.

Note that this filtering did not filter out 0x7F (DEL).  But that is
fine: it should not occur in the input stream at that point anyway,
as it gets translated to either KEY_DC or KEY_BACKSPACE earlier in
the keyboard parsing routines.
2020-02-12 11:12:34 +01:00
Benno Schulenberg cbeea859c2 shutdown: don't refer to an open file when there aren't any
This fixes https://savannah.gnu.org/bugs/?57780.

Bug existed since commit b63c90bf from yesterday.
2020-02-10 09:28:37 +01:00
Benno Schulenberg 7ce1f6d86d locking: when finding a lock file at startup, quit when user cancels
When at startup the user presses Cancel at the "open anyway?" prompt,
cancel the whole startup: quit.  But when the user answers No, just
skip the file and continue starting up.
2020-02-02 13:00:37 +01:00
Benno Schulenberg a2f8703df5 tweaks: tumble three conditions, for consistency in comparisons 2020-01-31 16:05:51 +01:00
Benno Schulenberg a692b01c04 tweaks: reshuffle two lines, to do the linking first, then the content 2020-01-29 12:33:30 +01:00
Benno Schulenberg a197ccf12d tweaks: move another function, to group the deleting ones together 2020-01-29 12:16:09 +01:00
Benno Schulenberg 67e5913edf tweaks: move another function to before the one that calls it 2020-01-29 10:54:30 +01:00
Benno Schulenberg e864107046 tweaks: move a function to right before the one that calls it 2020-01-29 10:53:05 +01:00
Benno Schulenberg 7984ea4eb6 tweaks: remove two superfluous assignments, and rename a variable
The 'prev' and 'next' links get assigned to immediately after the
call of copy_node().  And anyway, it does not make sense to link
a copied node to the predecessor and successor of its original.

Also slightly regroup some lines.
2020-01-29 10:47:09 +01:00
Benno Schulenberg f38bd5030d tweaks: add a little change that was overlooked in the previous commit
Option --showcursor applies also to the help viewer, which means that
it can do something useful in restricted mode too.
2020-01-28 12:00:05 +01:00
Benno Schulenberg a2fea9928d build: exclude option '-g' when configured without browser and help 2020-01-28 10:33:56 +01:00
Benno Schulenberg 445cd2a6c5 usage: improve the description of --restricted and --quickblank
Give a little more information than just a rehash of the long option.
2020-01-28 10:04:01 +01:00