Benno Schulenberg
9bf57e5ca0
tweaks: do not needlessly renumber the lines in the buffer
...
For cuts, pastes, and inserts, the lines have already been renumbered;
for indents, comments, and replacements, the line numbers cannot have
changed. (And anyway, variable 'f' is not set for those cases.)
Only when lines get split (ENTER) or fused together (JOIN) do the later
lines need to be renumbered. This mirrors what is done for do_redo().
2018-03-04 10:27:07 +01:00
Benno Schulenberg
f9103a5cb5
tweaks: make the fsfromline() call only for the undo types that need it
...
The 'f' variable is used only in the ADD, BACK, DEL, ENTER, JOIN, and
REPLACE undo/redo cases. So, avoid making a somewhat costly call when
it is entirely superfluous. Rearrange the undo types to make checking
for the above six types easier.
2018-03-03 17:12:25 +01:00
Benno Schulenberg
e9eabdcdcb
undo: when redoing, don't try to find a line number that might not exist
...
This fixes https://savannah.gnu.org/bugs/?53272 .
2018-03-03 16:41:33 +01:00
Benno Schulenberg
a1be8b6a19
tweaks: condense a comment and elide an 'if'
2018-03-01 11:18:56 +01:00
Benno Schulenberg
de4fbadf20
tweaks: reshuffle some code, to be slightly less ugly
2018-03-01 11:08:13 +01:00
Benno Schulenberg
bdd8920081
bindings: make a key defined as string work also in browser and viewer
2018-03-01 10:55:04 +01:00
Benno Schulenberg
8f1a657a37
bindings: revert the ^/ changes, as ^/ is not always Go-To-Line
...
On a Linux console, ^/ produces Backspace, making it unrebindable.
This fixes https://savannah.gnu.org/bugs/?53248 .
2018-03-01 09:50:54 +01:00
Benno Schulenberg
3b8c898880
help: tweak the descriptions of ^X and ^R
...
It is not a problem to say that ^X closes the current buffer
even when nano is compiled without multibuffer support.
2018-02-27 18:11:16 +01:00
Benno Schulenberg
6f4f1878fc
selecting: cancel the softmark upon any attempt to move the cursor
...
This assumes that all movement functions are located together,
starting with to_first_line() and ending with do_right().
This fixes https://savannah.gnu.org/bugs/?53195 .
Reported-by: Brand Huntsman <alpha@qzx.com>
2018-02-27 18:09:00 +01:00
Benno Schulenberg
5eccaa7633
tweaks: refactor the implanting of a key expansion
2018-02-27 13:34:32 +01:00
Benno Schulenberg
d9ac785a07
input: handle the implant() function separately also for the prompt
...
To prevent getting kicked out of it.
This fixes https://savannah.gnu.org/bugs/?53234 .
2018-02-27 13:20:27 +01:00
Benno Schulenberg
01457ae3d3
input: handle the implant() function separately, as it is special
...
The implant() function itself cannot be bound to anything, so it
is not in the linked list of functions -- trying to find it would
lead to a NULL pointer, and thus to a segfault.
This fixes https://savannah.gnu.org/bugs/?53233 .
2018-02-27 11:11:02 +01:00
Benno Schulenberg
c757aee235
tweaks: correct a typo that broke binding a key to a string
...
Commit 0cf455bc
introduced the typo.
2018-02-27 10:28:52 +01:00
Benno Schulenberg
54103d8ed1
tweaks: elide another variable, to call a function less often
...
Instead of always calling sctofunc(), it is now only called when
in view mode OR when (after the keystroke's function has been run)
no need for a refresh has been established yet.
2018-02-25 10:41:51 +01:00
Benno Schulenberg
53a10ddcaf
tweaks: elide an unneeded variable
...
A shortcut's function must be among the existing ones, otherwise
nano's code is fundamentally broken.
2018-02-24 20:47:17 +01:00
Benno Schulenberg
65bf04060b
tweaks: remove another superfluous check
...
Commit bb667beb
removed do_gotolinecolumn_void() from the MWHEREIS
menu (replacing it with the empty flip_goto() function), so there
is no longer any need to check for this one special case.
2018-02-24 20:47:01 +01:00
Benno Schulenberg
a95fb64dd6
tweaks: remove a superfluous check
...
A shortcut's function can never be NULL.
2018-02-24 19:53:19 +01:00
Benno Schulenberg
b235404ade
tweaks: elide an unused variable and parameter
...
It is only ever set and never referenced.
2018-02-24 19:42:43 +01:00
Benno Schulenberg
ffebd31cbb
tweaks: shorten the name of two record elements
...
Exclude the confusing, pleonastic 'sc' abbreviation from their names.
2018-02-24 19:31:11 +01:00
Benno Schulenberg
e55227f65f
tweaks: unabbreviate two variable names
2018-02-24 18:20:30 +01:00
Benno Schulenberg
b77b54bf73
tweaks: elide two unneeded booleans
2018-02-24 17:51:27 +01:00
Benno Schulenberg
2428620b16
prompt: disallow pasting when in restricted mode
2018-02-24 13:54:49 +01:00
Benno Schulenberg
b027263a37
small addition: allow customizing the color of an error message
...
The new option 'set errorcolor' allows the user to specify the color
combination for the status bar when an error message is displayed.
2018-02-23 12:35:17 +01:00
Benno Schulenberg
1a926d79c5
help: mention that some keys work on a region when the mark is on
...
This fixes https://savannah.gnu.org/bugs/?53188 .
Reported-by: Ken Tyler <kent@werple.net.au>
2018-02-23 12:35:12 +01:00
Benno Schulenberg
c79fe1a160
bindings: show ^/ instead of ^_ for Go-To-Line
...
The slash is easier to read than the underscore (which almost
disappears at the bottom of the screen), and easier to type
(no Shift needed on a US keyboard), and it kind of harmonizes
with the ^\ for Replace and the M-/ for End-of-buffer.
2018-02-23 12:26:30 +01:00
Benno Schulenberg
dd9766c2e0
editing: when --smooth is used, make <Enter>-at-bottom scroll one row
...
When using --smooth or 'set smooth', the screen should scroll the
minimum amount needed to get the cursor back into view. (The only
exceptions are search, undo, and redo -- when there the cursor goes
offscreen, the cursor line is centered.)
This change brings the behavior of pressing <Enter> on the bottom
row into line with, for example, pasting a single line. See also
http://lists.gnu.org/archive/html/nano-devel/2018-02/msg00027.html .
2018-02-16 11:48:24 +01:00
Benno Schulenberg
5b870a7632
goto: avoid a segfault, by initializing 'answer' when it is NULL
...
This fixes https://savannah.gnu.org/bugs/?53157 .
2018-02-14 19:40:30 +01:00
Benno Schulenberg
0cf455bc48
build: fix compilation when configured with --enable-tiny
...
And when configured with --enable-tiny --enable-nanorc.
2018-02-14 19:29:29 +01:00
Benno Schulenberg
3e1fc6385b
syntaxes: remove quotes from each syntax name, and color it differently
...
The different color will make the name stand out, as it should, instead
of looking the same as all the regex strings.
2018-02-14 17:36:50 +01:00
Benno Schulenberg
544cda6a62
rcfile: allow a syntax name to be unquoted
2018-02-14 17:35:37 +01:00
Benno Schulenberg
28933cf572
tweaks: remove two superfluous checks, and restrict two others
...
When 'refresh_needed' is already TRUE, there is no need any more
to check whether it should be set.
[Those first two calls are leftovers from before the time that
reset_multis() morphed into check_the_multis().]
2018-02-14 17:29:59 +01:00
Benno Schulenberg
1635060ba6
tweaks: plug a memory leak when using Verbatim Input at a prompt
...
This fixes https://savannah.gnu.org/bugs/?53089 .
2018-02-08 17:54:31 +01:00
David Lawrence Ramsey
7a038adfd4
input: don't stop prepending when the user adds text via a shortcut
...
When characters are added via Verbatim Input or by pressing <Tab>,
the prepend flag should be retained, just like when characters are
typed directly.
This fixes https://savannah.gnu.org/bugs/?52956 .
2018-02-08 17:35:56 +01:00
Benno Schulenberg
f1b5be4bbf
tweaks: elide an unneeded variable
2018-02-07 19:42:19 +01:00
Benno Schulenberg
9ceeabda38
memory: avoid a leak when toggling from Search to Goto
...
This fixes https://savannah.gnu.org/bugs/?53088 .
2018-02-07 19:34:52 +01:00
Benno Schulenberg
204e1b8353
memory: squeal when there is something wrong, instead of stumbling on
...
When copying a string, source and destination may not be equal --
complain loudly when they are, instead of failing to free memory.
Also, instead of freeing the destination string and then allocating
it afresh, just reallocate it -- that should be slightly quicker.
2018-02-07 19:34:43 +01:00
Benno Schulenberg
d865d7ac8f
search: clear the existing answer when starting a new search
...
When doing for example: ^W xx ^R ^C ^W, the "xx" would again be shown
after the prompt. This is wrong -- when starting a new search, the
current answer should be empty.
Reported-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
2018-02-05 12:47:55 +01:00
Benno Schulenberg
16d237ba1b
tweaks: rename two variables, to be more meaningful
2018-02-04 22:07:33 +01:00
Benno Schulenberg
c3031b9b8f
tweaks: reshuffle some of the search-and-replace cleanup calls
2018-02-04 21:31:04 +01:00
Benno Schulenberg
d289510724
tweaks: adjust comments and indentation after the previous change
2018-02-04 21:23:48 +01:00
Benno Schulenberg
60f1090da0
search: get rid of some unneeded recursion when just toggling things
...
Instead of weaving back and forth between do_search()/do_replace() and
search_init() every time that one of the options is toggled, just keep
looping in the latter function until the user presses <Enter>.
The weaving for the do_gotolinecolumn() function remains, but is
shortened to involve only search_init().
2018-02-04 20:26:06 +01:00
David Lawrence Ramsey
8f6ee22b41
tweaks: fix typo in rebindable function name
...
This fixes https://savannah.gnu.org/bugs/?53062 .
2018-02-04 18:31:24 +01:00
Benno Schulenberg
a083d7f1e1
tweaks: rename a variable to be more distinct and greppable
2018-02-04 18:25:10 +01:00
Benno Schulenberg
919df09ffa
general: detect in a better way whether we're running on a Linux console
...
Suggested-by: Mike Frysinger <vapier@gentoo.org>
2018-02-04 18:23:13 +01:00
Benno Schulenberg
4295baa5fe
tweaks: transform a 'do' to a 'while', and reshuffle a comment
2018-02-04 18:14:28 +01:00
Benno Schulenberg
467cc8edf3
tweaks: remove two deprecated options and six rebindable function names
...
This addresses https://savannah.gnu.org/bugs/?48992 .
2018-02-04 13:51:13 +01:00
Benno Schulenberg
6d111c9343
new feature: allow binding a key to a string (in a nanorc file)
...
In this way a single keystroke can produce a fragment of text or a
series of commands, or a mix of the two. It is like a prerecorded
macro.
This fulfills https://savannah.gnu.org/bugs/?52931 .
2018-02-04 12:44:12 +01:00
Benno Schulenberg
bb667beb5a
bindings: rename the bindable function 'gototext' to 'flipgoto'
...
This brings it in line with the other three "flip" toggles.
2018-02-04 10:34:39 +01:00
Benno Schulenberg
eed765f4f7
tweaks: elide an unneeded variable
2018-02-04 10:15:26 +01:00
Benno Schulenberg
58ed3a8152
display: wipe the status bar when doing a total refresh
...
This fixes https://savannah.gnu.org/bugs/?52997 .
2018-01-28 21:08:28 +01:00
Benno Schulenberg
e11021a7a5
input: recognize the deviant keycode for <Ctrl+End> in urxvt
...
This fixes https://savannah.gnu.org/bugs/?52972 .
Reported-by: Brand Huntsman <alpha@qzx.com>
2018-01-28 16:15:21 +01:00
Benno Schulenberg
83c264939b
tweaks: move a bunch of comments to the lines that they refer to
2018-01-28 13:41:46 +01:00
Benno Schulenberg
d48f3e5e7b
help: don't get stuck when there is an unwrappable piece of text
...
When a fragment of help text does not contain any whitespace that
we can wrap at, just advance the pointer, because returning zero
would mean we stay forever at the same place: nano would hang.
2018-01-27 21:02:47 +01:00
Benno Schulenberg
b18e76d4d8
tweaks: drop two unneeded initializations, and trim a comment
2018-01-27 20:26:15 +01:00
Benno Schulenberg
f5c87a7fee
tweaks: swap the row and col parameters to a more consistent order
2018-01-27 20:00:14 +01:00
Benno Schulenberg
90ebff00ca
tweaks: rename two variables, and swap their declaration order
2018-01-27 19:47:00 +01:00
Benno Schulenberg
cdc9a29598
tweaks: move two functions to their proper place, orderingwise
2018-01-27 19:33:03 +01:00
Benno Schulenberg
18bf2af9c1
tweaks: rename a function, to be more distinct
...
So one doesn't find it when grepping for get_input().
2018-01-27 11:29:11 +01:00
Benno Schulenberg
97cbbb0cc8
prompt: show whitespace only in the filename, not in the whole line
...
That is, call display_string() just on the filename, not on the rest
of the prompt text.
This fixes https://savannah.gnu.org/bugs/?52967 .
Reported-by: Andreas Schamanek <schamane@fam.tuwien.ac.at>
2018-01-26 09:37:18 +01:00
Benno Schulenberg
7b9bd65362
tweaks: drop a useless assert, and don't abort over an unhandled option
2018-01-24 10:29:50 +01:00
Benno Schulenberg
f72fecee9b
copyright: update the years for the FSF
...
And one for me, for the much changed keyboard stuff.
2018-01-24 10:14:43 +01:00
Benno Schulenberg
f095e20a86
tweaks: exclude --trimblanks when no wrapping or justifying is configured
...
Also, actually add the long option --trimblanks to the table.
2018-01-24 09:59:01 +01:00
Benno Schulenberg
fa7e9b11df
input: recognize more escape sequences for <Shift+Home> and <Shift+End>
...
This fixes the second part of https://savannah.gnu.org/bugs/?52960 .
2018-01-23 19:44:18 +01:00
Benno Schulenberg
838b175d4f
input: recognize escape sequences for <Shift+PageUp> and <Shift+PageDown>
...
This fixes the first part of https://savannah.gnu.org/bugs/?52960 .
2018-01-23 19:32:13 +01:00
Benno Schulenberg
6795d079b1
tweaks: mark the two blocks that have a deviant indentation
...
Also, reshuffle a case, to put the short one first and lose a line.
2018-01-23 18:10:22 +01:00
Benno Schulenberg
e739448cd0
input: consume only the actual length of an escape sequence
...
Instead of assuming that the entire contents of the keybuffer are an
escape sequence (even if this is far longer than any escape sequence
can be), remove from the keybuffer only those integers that actually
constituted a sequence, valid or invalid.
This fixes https://savannah.gnu.org/bugs/?48659 .
2018-01-23 17:31:48 +01:00
Benno Schulenberg
8e328e43c2
input: make <Shift+Tab> do an unindent also on a Manjaro console
...
This fixes https://savannah.gnu.org/bugs/?52943 .
2018-01-23 16:52:51 +01:00
Benno Schulenberg
cb56a575fd
options: recognize -M and --trimblanks on the command line
2018-01-23 13:49:48 +01:00
Benno Schulenberg
a429dc4a76
tweaks: rename a variable, to better fit its usage
2018-01-23 13:09:12 +01:00
Benno Schulenberg
91073be49c
wrapping: don't trim a blank character that the user just typed
...
Trimming trailing spaces is good, but we should not trim the space
(or tab or other blank) that the user just typed and that caused the
hard-wrapping to occur.
This fixes https://savannah.gnu.org/bugs/?52948 .
Reported-by: Andreas Schamanek <schamane@fam.tuwien.ac.at>
2018-01-23 13:06:05 +01:00
Benno Schulenberg
d5f9be7dc8
painting: look for an end match only after a start match, if any
...
This fixes https://savannah.gnu.org/bugs/?52925 .
Reviewed-by: Brand Huntsman <alpha@qzx.com>
2018-01-22 11:03:40 +01:00
Benno Schulenberg
4ad0490ce4
tweaks: rename a variable, for more contrast
2018-01-20 18:22:24 +01:00
Benno Schulenberg
d85098abda
tweaks: reshuffle a couple of lines, to make a bit more sense
2018-01-19 20:27:53 +01:00
Benno Schulenberg
13f8ddcaf2
tweaks: remove a handful of redundant (because always true) asserts
...
And rewrap some lines, three of them to make them equal to another.
2018-01-19 20:09:06 +01:00
Benno Schulenberg
37e9ada964
tweaks: change a 'do' to a 'while', and return early to elide an 'if'
2018-01-19 18:05:24 +01:00
Benno Schulenberg
a99158c7c0
tweaks: remove a fragment of dead code
...
At that point, ptr will necessarily point at EOL -- *ptr == '\0'.
2018-01-19 17:56:17 +01:00
Benno Schulenberg
3981217e5a
startup: allow a named pipe as file argument when --noread is used
...
This fixes https://savannah.gnu.org/bugs/?52896 .
Reported-by: Miki Strange <mik@mikistrange.com>
Tested-by: Miki Strange <mik@mikistrange.com>
2018-01-16 21:43:16 +01:00
Benno Schulenberg
96b47f2877
tweaks: transform a parameter, from a pointer to the value itself
2018-01-15 20:09:03 +01:00
Benno Schulenberg
7da391beb7
tweaks: drop a superfluous parameter, as it is always 1
2018-01-15 19:54:12 +01:00
Benno Schulenberg
90cf4838d2
tweaks: don't bother to reallocate when the keybuffer size decreases
...
It will be reallocated soon enough when the size increases again.
2018-01-15 19:46:16 +01:00
Benno Schulenberg
704a7d7b4f
tweaks: rename two variables, for preciseness and shortness
...
Also remove an unneeded nulling.
2018-01-15 16:38:13 +01:00
Benno Schulenberg
64366d9992
startup: make an error message succinct and to the point
...
The verbosity "hid" the really relevant information:
filename, line number, and the error message.
Valid values and other details can be found in the manual pages.
2018-01-15 13:24:14 +01:00
Benno Schulenberg
bd97ae7255
tweaks: set a modifier in a single place, for conciseness
2018-01-15 13:15:23 +01:00
Benno Schulenberg
2ff398c685
tweaks: reshuffle some stuff, and avoid a memory leak
2018-01-15 13:07:42 +01:00
Brand Huntsman
4b24ce1c11
startup: parse interface colors when they are read, not when initialized
...
When the palette is getting initialized, it is too late to send any
error messages about the rcfile options to standard error.
This fixes https://savannah.gnu.org/bugs/?52871 .
Reported-by: Brand Huntsman <alpha@qzx.com>
Signed-off-by: Brand Huntsman <alpha@qzx.com>
2018-01-15 13:04:55 +01:00
Benno Schulenberg
00c1105c1b
search: suppress the occurrence at the cursor only when replacing
...
When we're just searching, we do want to report the occurrence at
the cursor (after coming full circle) as a match, so that we can
mention that this is the only occurrence. When replacing, we do
not want to replace this match twice.
This fixes https://savannah.gnu.org/bugs/?52888 .
2018-01-15 11:38:19 +01:00
Benno Schulenberg
898c4c6fbb
startup: move the initialization of colors, so any error gets printed
...
Suggested-by: Brand Huntsman <alpha@qzx.com>
2018-01-12 10:50:28 +01:00
Benno Schulenberg
c1bb6485de
tweaks: check for the type of terminal far earlier
...
So the result could be used during RC-file reading.
2018-01-12 09:51:43 +01:00
Benno Schulenberg
caeed6821c
tweaks: reshuffle two condition series, to look better
2018-01-11 13:02:55 +01:00
Benno Schulenberg
eb1bf8f927
tweaks: rename a variable, and further condense some comments
2018-01-11 12:52:14 +01:00
Benno Schulenberg
2c8b99d5e9
tweaks: condense and rewrap some comments, and reindent two lines
...
Also drop an old debugging fragment.
2018-01-11 10:51:18 +01:00
Benno Schulenberg
091dd71f08
tweaks: remove a superfluous case -- there can never be four digits
2018-01-11 10:31:23 +01:00
Benno Schulenberg
837475519b
input: fully reset state when a three-digit character code is cut short
...
There shouldn't be two separate variables (but with the same name) that
count the number of digits seen. Fuse them into a single static var.
This fixes https://savannah.gnu.org/bugs/?52863 .
2018-01-11 10:17:51 +01:00
Benno Schulenberg
31540e3e7e
tweaks: remove a superfluous check, as we insert always one code
2018-01-10 21:32:32 +01:00
Benno Schulenberg
ae3b8579fa
tweaks: condense a condition and a comment, and reshuffle a line
2018-01-10 21:25:19 +01:00
Benno Schulenberg
e1199cd94d
tweaks: elide a tiny intermediate buffer, and rename two variables
...
Use the same method as in parse_verbatim_kbinput() for Unicode input.
2018-01-10 20:33:12 +01:00
Benno Schulenberg
45d2458b47
tweaks: don't bother freeing the key buffer, just reallocate it
2018-01-10 19:25:23 +01:00
Benno Schulenberg
4c505e5127
tweaks: rename a function, for aptness, and drop a superfluous check
2018-01-10 17:40:07 +01:00
Benno Schulenberg
e3b13ae124
tweaks: reshuffle a couple of lines
2018-01-09 16:52:42 +01:00
Benno Schulenberg
e5440b390e
replacing: don't skip the first character of a backwards-marked region
...
Also, when replacing forwards, do not first skip the occurrence at the
cursor and then replace it at the end of the cycle, but begin with it,
as one would expect.
This fixes https://savannah.gnu.org/bugs/?52789
and fixes https://savannah.gnu.org/bugs/?52791 .
2018-01-09 16:52:42 +01:00
Benno Schulenberg
0bb6c0234f
tweaks: condense the conditional compilation of shortcut reassignments
...
These three functions are needed only when both linter and speller
are available.
2018-01-09 13:31:58 +01:00
Benno Schulenberg
7947d9d2a5
build: fix compilation when configured with --enable(tiny,color,nanorc}
...
This fixes https://savannah.gnu.org/bugs/?52834 .
Reported-by: <akiko@mailbox.org>
2018-01-09 13:30:25 +01:00
Benno Schulenberg
c9ccb39752
tweaks: fully include Savefile and Wherewas in the tiny version
...
If help is enabled, those functions should be described too,
and if nanorc is enabled, they should both be rebindable.
2018-01-09 11:49:21 +01:00
Benno Schulenberg
ada78dc89d
build: fix compilation with --enable-tiny --enable-justify
2018-01-08 19:12:41 +01:00
Benno Schulenberg
17429d7f38
tweaks: fix some whitespace errors, and convert alignment tabs to spaces
2017-12-29 21:35:14 +01:00
Benno Schulenberg
87206c0607
tweaks: convert the indentation to use only tabs
...
Each leading tab is converted to two tabs, and any leading four spaces
is converted to one tab. The intended tab size (for keeping most lines
within 80 columns) is now four.
2017-12-29 20:06:50 +01:00
Benno Schulenberg
b574f73e60
tweaks: add a separate function that actually wipes the status bar
2017-12-29 17:40:41 +01:00
Benno Schulenberg
eac90c3eff
prompt: blank the bar when a "continue?" is answered with No or ^C
...
This fixes https://savannah.gnu.org/bugs/?52755 .
Reported-by: Brand Huntsman <alpha@qzx.com>
2017-12-29 17:01:15 +01:00
Benno Schulenberg
440a128d25
indenting: keep affecting last line of marked region if it was at first
...
When unindenting/uncommenting affected the bottom line of the marked
region, keep affecting this line also during subsequent consecutive
indenting/commenting.
This fixes https://savannah.gnu.org/bugs/?52718 .
2017-12-29 16:52:17 +01:00
Benno Schulenberg
12073001c2
tweaks: condense, reword, and rewrap a bunch of comments
2017-12-26 22:14:25 +01:00
Benno Schulenberg
4c20135749
help: swap the order of the Complete and Comment functions
...
So that Commenting comes closer to the somewhat related Indenting
and Unindenting functions.
2017-12-26 21:36:29 +01:00
Benno Schulenberg
f9ebf038e0
tweaks: slightly rename four functions, for aptness and variety
2017-12-26 14:15:49 +01:00
David Lawrence Ramsey
62ebd93579
tweaks: use printf's z modifier for (s)size_t, instead of casting
2017-12-26 14:11:18 +01:00
Benno Schulenberg
a10fdc3fb1
help: show that "Tab" will indent, just like "Sh-Tab" will unindent
...
Also, make the descriptions for indenting/unindenting more precise.
2017-12-26 13:46:34 +01:00
Benno Schulenberg
8581e702d6
tweaks: move some frequently-used keystrokes to the top of the list
...
So they will be found quicker.
Also fold two assignments into one.
2017-12-26 13:31:50 +01:00
Benno Schulenberg
23d66949e1
tweaks: frob four comments, and rewrap two lines
2017-12-24 11:53:38 +01:00
Benno Schulenberg
184bb11fd9
tweaks: factor out a piece of common code
2017-12-24 11:25:10 +01:00
Benno Schulenberg
a70db34fc9
tweaks: remove two irrelevant conditions
...
They were mistakenly added by changeset fb85c055
, four commits ago.
2017-12-24 11:10:41 +01:00
Benno Schulenberg
fbde1b2d71
tweaks: reshuffle another bit of code, for conciseness
2017-12-24 10:56:16 +01:00
Benno Schulenberg
c22fef18e4
tweaks: reshuffle a bit of common code, moving it to an existing function
2017-12-23 21:50:18 +01:00
Benno Schulenberg
ee5b250b66
indenting: don't exclude last line of region when region is empty
...
This fixes https://savannah.gnu.org/bugs/?52717 .
2017-12-23 11:42:25 +01:00
Benno Schulenberg
fb85c05594
text: keep cursor at left edge when it IS there when indenting/commenting
...
Suggested-by: Brand Huntsman <alpha@qzx.com>
2017-12-21 19:47:22 +01:00
Benno Schulenberg
25b1114e03
tweaks: elide two parameters from the get_region() function
2017-12-21 19:47:22 +01:00
Benno Schulenberg
4b8a387529
text: let indenting/commenting skip the last line if its x is zero
...
If the marked region ends at the start of a line, do not include that
line in the indenting/undenting or commenting/uncommenting. This is
closer to what the eye would expect.
2017-12-21 19:47:22 +01:00
Benno Schulenberg
df41114e0e
tweaks: drop some old debugging code plus a superfluous comment
2017-12-21 19:45:18 +01:00
Benno Schulenberg
dc3618a127
text: set and reset the Modified state correctly when undoing/redoing
...
Unset the "Modified" marker only at the point where the file was last
saved -- if there is such a point, because it can be missing when the
undo stack was discarded.
This fixes https://savannah.gnu.org/bugs/?52689 .
Reported-by: Liu Hao <lh_mouse@126.com>
Original-idea-by: Brand Huntsman <alpha@qzx.com>
2017-12-19 19:22:52 +01:00
Benno Schulenberg
31fe0753e3
tweaks: limit the resetting of "Modified" to writing a full buffer
...
When doing that, there is no need to save and restore the Modified
state when writing a marked region.
2017-12-19 17:57:49 +01:00
Benno Schulenberg
7ad5afb935
tweaks: remove some unneeded parentheses, and shorten two function calls
2017-12-17 20:32:17 +01:00
Benno Schulenberg
e1b0f2b275
display: ensure that cursor is visible when compiled with --with-slang
...
This fixes https://savannah.gnu.org/bugs/?52651 .
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
2017-12-17 16:34:02 +01:00
Benno Schulenberg
0e0fb452a3
input: optimize a bit for non-shortcut keys, as they are most frequent
2017-12-17 12:49:04 +01:00
David Lawrence Ramsey
f66432e999
input: support backtab when Slang and/or --rebindkeypad is used
...
The escape sequence "Esc [ Z" is a backtab on most supported terminals,
so make sure convert_sequence() treats it as such.
2017-12-17 12:11:35 +01:00
Benno Schulenberg
08e9d30fa2
tweaks: condense some debugging code, and rewrap a line
2017-12-16 21:50:10 +01:00
Benno Schulenberg
d2270e514b
input: make <Ctrl+Shift+Arrow> work also when using --rebindkeypad
...
The function get_keycode() should never return zero -- it should
return either the code from ncurses or the given fallback code.
This fixes https://savannah.gnu.org/bugs/?52682 .
2017-12-16 21:09:01 +01:00
Benno Schulenberg
031305c205
tweaks: strip some debugging stuff, and condense a bit of code
2017-12-16 19:56:15 +01:00
Benno Schulenberg
e2843ede7e
text: let a Shift-selection persist when indenting and commenting
...
To achieve that, fake the Shift key being held when indenting/
unindenting/commenting/uncommenting.
Reported-by: Brand Huntsman <alpha@qzx.com>
2017-12-12 21:09:28 +01:00
Benno Schulenberg
09958ebdff
input: allow using <Tab> and <Shift+Tab> to (un)indent selected region
...
When the mark is on, instead of letting a <Tab> simply insert a Tab
character at the cursor position, let it indent the marked region.
Original-idea-by: Chris Allegretta <chrisa@asty.org>
2017-12-12 20:37:41 +01:00
Benno Schulenberg
a95c6c5fe8
tweaks: condense or rewrap a bunch of repetitious comments
2017-12-11 20:02:43 +01:00
Benno Schulenberg
bcd187d7d6
tweaks: rewrap some lines and some comments, and trim two others
2017-12-10 20:03:51 +01:00
Benno Schulenberg
03783a7d1b
tweaks: trim another placing of a terminating nul byte
...
Make both preceding character moves include the terminating byte.
2017-12-10 19:56:36 +01:00
Benno Schulenberg
f2fb8c01f4
tweaks: remove a superfluous placing of a terminating nul byte
...
The character move has already copied the terminating byte.
And a reallocation to save just one character of memory is
a waste of time.
2017-12-10 19:49:57 +01:00
Benno Schulenberg
eb937f81fa
text: allow unindenting when not all lines are indented
...
And also allow it when lines are only partially indented.
This makes it possible to equalize the indentations of (accidentally)
unevenly indented lines: by first fully unindenting a group of lines,
and then reindenting them to the desired amount.
Suggested-by: Liu Hao <lh_mouse@126.com>
2017-12-09 17:44:12 +01:00
Benno Schulenberg
b4411b4f28
wrapping: we're still on the same line if the next line has not changed
...
In this way we can delete things on the current line with ^K (after
Shift-selecting some text) without nano misdetecting a line change,
This fully fixes https://savannah.gnu.org/bugs/?52576 .
2017-12-07 19:41:10 +01:00
Benno Schulenberg
29f7654ab1
wrapping: keep prepending to the same next line as long as possible
...
Only when the cursor has moved off of the currrent line do we stop
prepending wrapped words to the next line.
This partially fixes https://savannah.gnu.org/bugs/?52576 .
2017-12-07 19:41:04 +01:00
Benno Schulenberg
66fd6a5ab1
options: rename 'justifytrim' to 'trimblanks', because it has morphed
...
The option now causes nano to trim trailing whitespace also when
hardwrapping occurs while the user is typing.
2017-12-06 20:38:13 +01:00
Benno Schulenberg
c30d3d8010
wrapping: delete trailing blanks upon hardwrapping, when requested
...
This fulfills https://savannah.gnu.org/bugs/?52198 .
2017-12-06 20:32:08 +01:00
Benno Schulenberg
0c40f87b55
tweaks: invert the logic of a variable, and rename it
...
To get rid of two double negatives.
2017-12-03 20:49:01 +01:00
Benno Schulenberg
0133d5cba8
tweaks: elide two variables that are used just once
2017-12-02 18:07:50 +01:00
Benno Schulenberg
9066a96dde
tweaks: rename three variables, for more contrast and variety
2017-12-02 18:07:22 +01:00
Benno Schulenberg
6abb551fdd
tweaks: avoid incrementing a variable that won't be used again later
2017-12-02 17:55:27 +01:00
Benno Schulenberg
97bdf13b59
tweaks: remove a redundant call of renumber()
...
The call of do_delete() four lines earlier already does a renumber.
2017-12-02 17:47:01 +01:00