Benno Schulenberg
ae648778e2
screen: refresh when a new magicline is added in line-numbering mode
...
This fixes https://savannah.gnu.org/bugs/?49406 .
2016-10-21 15:59:16 +02:00
Benno Schulenberg
023edffe3d
screen: move the margin determination to the main loop
...
There is no need to look at this for every painted line, because
the margin can only change when some key is struck.
2016-10-21 14:56:56 +02:00
Benno Schulenberg
2789bb0813
screen: repaint the edit window in a single place -- the main loop
...
Instead of doing this in two places: after interpreting shortcuts,
and after injecting characters.
2016-10-21 14:56:53 +02:00
Benno Schulenberg
4d996e4c39
screen: suppress line numbers when the terminal is very narrow
...
To prevent the display from getting messed up, making nano unusable.
2016-10-21 14:55:43 +02:00
Benno Schulenberg
de2aa4f24a
rcfile: add an option to customize the color of line numbers
2016-10-20 16:48:45 +02:00
Faissal Bensefia
de95ca68f7
new feature: the ability to show line numbers before the text
...
It can be activated with --linenumbers on the command line or with
'set linenumbers' in a nanorc file, and it can be toggled with M-#.
Signed-off-by: Faissal Bensefia <faissaloo@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-10-20 16:47:52 +02:00
Benno Schulenberg
55878efe5d
binding: supply the keycode for most special keys directly
...
Instead of figuring them out from the string. This is possible
because those dedicated editing keys cannot be rebound anyway.
2016-10-18 20:38:27 +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
d66ea08473
moving: adjust the Y position to correspond with the changed X position
...
So the softwrap code in do_down() can compute the correct amount to scroll.
This fixes https://savannah.gnu.org/bugs/?49374 .
2016-10-18 11:46:15 +02:00
Benno Schulenberg
8476bf86a1
tweaks: fix compilation when configured with --enable-tiny
2016-10-15 18:05:01 +02:00
Benno Schulenberg
c92982d60f
binding: fix some duplicated carets and too restrictive menus
2016-10-15 17:18:51 +02:00
Benno Schulenberg
7a274d621a
binding: use arrows instead of words to designate the cursor keys
2016-10-15 17:04:01 +02:00
Benno Schulenberg
fdee0df849
input: keep the Ctrl+Arrow keys working when their synonyms are unbound
...
This fixes https://savannah.gnu.org/bugs/?49058 reported by Rishabh Dave.
2016-10-15 17:03:10 +02:00
Benno Schulenberg
7013039c3a
tweaks: rename a variable, for consistency
2016-10-12 21:10:04 +02:00
Benno Schulenberg
925ad6393a
tweaks: remove a superfluous setting, and add a comment
2016-10-12 21:07:16 +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
0a18d8912b
screen: defeat a VTE bug by doing an extra cursor move and update
...
This fixes https://savannah.gnu.org/bugs/?49106 .
2016-10-12 13:56:48 +02:00
Rishabh Dave
01bf034bb6
rcfile: reject rebindings that have no effect or have side effects
...
Also, show in green only the ^ and M- combinations that are valid.
This fixes https://savannah.gnu.org/bugs/?49097 .
Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-10-11 19:46:18 +02:00
Benno Schulenberg
d716809228
scrolling: don't put the last line at the bottom when softwrap in on
...
This avoids https://savannah.gnu.org/bugs/?49298 .
2016-10-10 13:19:51 +02:00
Benno Schulenberg
8041627cc3
tweaks: remove a bit of duplication
2016-09-20 12:54:16 +02:00
Benno Schulenberg
598e0af7af
softwrap: scroll the current line fully into view when jumping words
...
This fixes https://savannah.gnu.org/bugs/?47710
and fixes https://savannah.gnu.org/bugs/?49088 .
2016-09-20 12:29:10 +02:00
Benno Schulenberg
8ba57cf87b
input: don't return zero when some function is completely unbound
...
Returning a zero would mean returning a ^Space -- the keycode that
by default is bound to the Next-Word function. So, unbinding the
keys to which the modified Arrow keys are hard bound would cause
the latter ones to mysteriously jump to the next word.
This partially fixes https://savannah.gnu.org/bugs/?49058 .
2016-09-20 11:11:44 +02:00
Rishabh Dave
e2027aee15
rcfile: reject key names that are wrong or too long
...
Meta keys should have a dash as second character, and apart from ^Space
and M-Space key names should be at most two or three characters long.
This fixes https://savannah.gnu.org/bugs/?44688 .
Reviewed-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
2016-09-14 19:53:38 +02:00
Benno Schulenberg
97f6ae5267
softwrap: scroll 'enough' whenever it surpasses 'amount'
...
This fixes https://savannah.gnu.org/bugs/?49086 .
2016-09-14 12:40:58 +02:00
Benno Schulenberg
fc9c7b4917
softwrap: scroll when searching lands on an overlong bottom line
...
This fixes https://savannah.gnu.org/bugs/index.php?42189 .
2016-09-14 11:02:36 +02:00
Benno Schulenberg
77a1a5c3e4
tweaks: reshuffle some ifdefs, for less fragmentation
2016-09-14 11:00:18 +02:00
Benno Schulenberg
bc8bb7e942
screen: keep the help items nicely lined up also in the tiny version
2016-09-13 09:29:44 +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
4de0a5049b
tweaks: reshuffle an if statement
2016-09-11 21:43:47 +02:00
Benno Schulenberg
dc76e84657
files: alert about an unwritable file also in the tiny version
2016-09-11 21:40:50 +02:00
Benno Schulenberg
1c2b35675e
tweaks: adjust some indentation
2016-09-11 21:36:46 +02:00
Benno Schulenberg
09e95b2d91
tweaks: frob a few comments
2016-09-11 11:26:09 +02:00
Benno Schulenberg
03fd6f3af8
tweaks: remove a useless cursor movement
2016-09-11 10:43:21 +02:00
Benno Schulenberg
b92d35d1f2
browser: add the option showcursor, to place the cursor on the highlight
...
This lets users of braille displays find the selected item immediately.
This fulfills a request by Enrico Mioso.
See https://lists.gnu.org/archive/html/nano-devel/2016-09/msg00025.html .
2016-09-11 09:41:52 +02:00
Benno Schulenberg
ad83ed22d9
input: handle the "resize key" in a better way
...
And correct a comment: the key /does/ occur also in the tiny version.
2016-09-06 12:09:18 +02:00
Benno Schulenberg
f13707fd1d
history: slate the search-history migration for removal
2016-09-03 21:04:17 +02:00
Benno Schulenberg
ed9e5d7183
docs: mark some rebindable function names as deprecated
2016-09-03 20:12:29 +02:00
Benno Schulenberg
2fd497e3ef
tweaks: remove a superfluous blanking of the statusbar
...
The prompt from which the browser was invoked has already blanked it.
2016-09-03 15:34:44 +02:00
Benno Schulenberg
fd6308d6d3
tweaks: reshuffle a couple of items
2016-09-03 13:42:19 +02:00
Benno Schulenberg
1dbebbcadc
screen: keep the help items aligned in more configurations
...
This fixes https://savannah.gnu.org/bugs/?48987 .
2016-09-03 13:35:19 +02:00
Benno Schulenberg
57d1755d10
tweaks: preen some comments, and reshuffle a few ifdefs
2016-09-03 12:14:08 +02:00
Benno Schulenberg
bace664fbc
startup: allow to rebind the RegExp toggle also in the tiny version
...
This fixes https://savannah.gnu.org/bugs/?48988 .
2016-09-03 11:45:49 +02:00
Benno Schulenberg
acd8809d71
tweaks: use hard-baked keycodes where possible
...
These keycodes have non-rebindable entries in the list of shortcuts, so
they will always be there -- no need for a function call to find them.
2016-09-02 12:04:29 +02:00
Benno Schulenberg
7b7d2bf7c9
tweaks: make tiny nano a teeny bit smaller
2016-09-02 12:01:03 +02:00
Benno Schulenberg
08b770d425
files: close a lockfile after reading it
2016-08-30 11:48:35 +02:00
Benno Schulenberg
2dffcf101f
tweaks: fix compilation with --disable-histories
2016-08-30 11:14:19 +02:00
Benno Schulenberg
96fbdfbc7d
input: unset a softmark whenever a character is typed
2016-08-30 10:41:28 +02:00
Benno Schulenberg
272a953889
tweaks: fix compilation when configured with --with-slang
2016-08-30 10:12:02 +02:00
Benno Schulenberg
db310ac9b6
input: ignore the resize "key", to prevent reporting an unbound key
...
In the tiny version it would beep and report an unbound key for every
window resize.
2016-08-30 09:40:51 +02:00
Benno Schulenberg
c11c688420
tweaks: fix compilation with --enable-tiny again
2016-08-30 09:36:49 +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
5ad26f864a
tweaks: adjust indentation after previous change
2016-08-29 13:36:29 +02:00
Benno Schulenberg
e7f39bc248
tweaks: remove an unneeded check, reshuffle some things, add a comment
...
Resetting the cutbuffer is irrelevant when 'allow_funcs' is false or
when in view mode, so do_input() can just return in those cases.
2016-08-29 13:35:35 +02:00
Benno Schulenberg
0242d84218
tweaks: make a call in one place instead of in four different ones
...
And remove a superfluous call.
2016-08-28 21:27:52 +02:00
Benno Schulenberg
7275e11c4f
tweaks: adjust some comments and remove needless asserts
2016-08-28 18:17:10 +02:00
Benno Schulenberg
77d140728d
tweaks: don't bother trimming the prompt again
...
The prompt has already been trimmed in do_prompt() to fit into the
available space.
2016-08-28 17:53:44 +02:00
Benno Schulenberg
4d2ada60f5
tweaks: don't bother avoiding unneeded rewrites of the promptbar
...
Leave the optimization of actual screen writes to ncurses.
2016-08-28 17:37:25 +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
aeb49a8013
bottombar: only count help items that have a shortcut bound to them
...
This avoids showing a ghost item in, for example, the WriteOut menu
when not using --tempfile and the user does not bind 'discardbuffer'.
2016-08-27 12:22:59 +02:00
Benno Schulenberg
c05c914eee
tweaks: rename three variables
2016-08-27 12:10:18 +02:00
Benno Schulenberg
c19f0c732e
tweaks: simplify the determination of the number of shown help items
2016-08-27 12:06:08 +02:00
Benno Schulenberg
6ad3700a3d
prompt: mouse clicks that moved the cursor need no further processing
...
This fixes https://savannah.gnu.org/bugs/?48917 .
2016-08-27 12:00:08 +02:00
Benno Schulenberg
4f156aa6db
prompt: set up the prepared answer before allowing to change it
...
This fixes https://savannah.gnu.org/bugs/?48916 .
2016-08-27 11:59:57 +02:00
Benno Schulenberg
6142ef87b5
prompt: use angular brackets as continuation mark, as Pico does
...
The $ sign looks too much like an S, and it "obscures" the answer by
being so "massive". The < and > signs are lighter and work better.
2016-08-27 09:34:54 +02:00
Benno Schulenberg
da2fce90bd
tweaks: elide a variable and rename some others
2016-08-27 09:34:42 +02:00
Benno Schulenberg
1e3cffbbd6
prompt: show a trailing $ when the tail of the answer is offscreen
...
This fixes https://savannah.gnu.org/bugs/?48894 .
2016-08-26 21:42:23 +02:00
Benno Schulenberg
92c97c70d4
prompt: leave always at least the last character of the answer visible
...
This fixes https://savannah.gnu.org/bugs/?48912 .
2016-08-26 21:32:07 +02:00
Benno Schulenberg
b77b1391c3
tweaks: improve some indentation and reshuffle a few lines
2016-08-26 12:24:18 +02:00
Benno Schulenberg
7e0c4e5726
tweaks: rename a function and adjust indentation
2016-08-25 20:20:50 +02:00
Benno Schulenberg
50616148b0
prompt: recompose the statusbar text whenever the window size changes
...
This fixes https://savannah.gnu.org/bugs/?48796 .
2016-08-25 20:12:36 +02:00
Benno Schulenberg
2f9232a493
tweaks: adjust indentation after previous change
2016-08-25 11:45:38 +02:00
Benno Schulenberg
0d5fbfb91c
tweaks: reshuffle some things, and remove a misplaced comment
2016-08-25 11:45:34 +02:00
Benno Schulenberg
56147434f3
prompt: don't crash when the terminal is less than four columns wide
...
This fixes https://savannah.gnu.org/bugs/?48792 .
2016-08-25 11:45:13 +02:00
Benno Schulenberg
21cb01e543
tweaks: rename two variables, to make some sense
...
And move a statement to a better place.
2016-08-25 11:45:05 +02:00
Benno Schulenberg
ea9aaee8c7
statusbar: leave out the brackets when the message is very long
...
This also prevents the message from spilling into the help lines
when the terminal is less than four columns wide. (Not that one
can read anything then, but it looks better.)
2016-08-25 11:45:01 +02:00
Benno Schulenberg
c22cd03f18
prompt: work around a VTE bug by outdancing an ncurses optimization
...
This fixes https://savannah.gnu.org/bugs/?48852 .
2016-08-25 10:46:28 +02:00
Benno Schulenberg
bd1c5d7c63
moving: make PgUp and PgDown functional also in very flat terminals
...
Even when the edit window consists of just one or two lines, the PageUp
and PageDown functions (^Y and ^V) should continue to move the window.
This fixes https://savannah.gnu.org/bugs/?48805 .
2016-08-21 15:52:24 +02:00
Benno Schulenberg
00b293bf70
tweaks: adjust some braces and indentations
2016-08-21 15:39:00 +02:00
Benno Schulenberg
76a960d73d
screen: continue to function also in a terminal with very few lines
...
This fixes https://savannah.gnu.org/bugs/?48787 .
2016-08-17 10:13:22 +02:00
Benno Schulenberg
97eb0e515f
tweaks: reshuffle some stuff in a more logical order
2016-08-16 19:22:56 +02:00
Benno Schulenberg
68010d931a
startup: don't crash when dying early
...
That is: don't try to look at open files when none are open yet.
2016-08-16 16:59:37 +02:00
Benno Schulenberg
c661506681
tweaks: use a separate function to ask ncurses for keycodes
2016-08-16 12:01:59 +02:00
Benno Schulenberg
0dd2a55284
screen: don't die when the window is narrower than four columns
...
This fixes https://savannah.gnu.org/bugs/?48520 .
2016-08-15 17:25:33 +02:00
Benno Schulenberg
49fc528d88
restore the GNU marker in nano's name
2016-08-14 21:42:37 +02:00
Benno Schulenberg
928a24c204
input: look at the modifier keys only when compiled on Linux
...
This fixes https://savannah.gnu.org/bugs/?48751 reported by Andrew Ho.
This also fixes compilation when configured with --enable-tiny.
2016-08-14 21:42:08 +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
290d278f68
input: make the Ctrl+Arrow keys work on a Linux console
...
If this breaks your build, please send report or instructions or patch.
2016-08-07 18:20:34 +02:00
Benno Schulenberg
8edb096821
input: after an Esc, don't discard starter byte of a multibyte sequence
...
This fixes https://savannah.gnu.org/bugs/?48711 .
2016-08-07 17:40:38 +02:00
Benno Schulenberg
0a387d9d08
usage: show that the option --wordchars needs an argument
2016-08-07 17:04:23 +02:00
Benno Schulenberg
6c16744292
files: avoid a warning about not being able to write a lockfile
...
Instead be more specific and say that the directory is not writable.
2016-08-07 13:00:35 +02:00
Benno Schulenberg
86a64b1bb5
tweaks: reduce two comparisons to a single one
2016-08-07 13:00:21 +02:00
Rishabh Dave
1fd2354ad4
shortcuts: zero the value of 'toggle' for keys that are not toggles
...
This fixes http://savannah.gnu.org/bugs/?48698 .
Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
2016-08-07 11:31:55 +02:00
Benno Schulenberg
c8bc05b10e
chars: make searching case-insensitively some ten percent faster
...
It is quicker to do a handful of superfluous compares at the end of
each line than it is to compute and keep track of and compare the
remaining line length the whole time.
The typical line is some sixty characters long, the typical search
string ten characters -- with a shorter search string the speedup is
even higher: some fifteen percent. Only when the string is longer
than half the average line length does searching become slower with
this new method.
All this for a UTF-8 locale. For a C locale it makes no difference.
2016-08-07 11:02:41 +02:00
Benno Schulenberg
ee57cbfa66
debug: add a timing instrument to the main search routine
2016-08-07 10:14:42 +02:00
Benno Schulenberg
bd1fcc5fe2
tweaks: correct one comment, and adjust another
2016-08-06 12:17:24 +02:00
Benno Schulenberg
370406bb41
tweaks: don't optimize for a special case -- it is far too seldom
2016-08-06 11:11:56 +02:00
Benno Schulenberg
85844ee6ef
chars: remove superfluous afterchecks
...
Now that mbstrncasecmp() does the right thing, there is no need any
more to verify that only a valid multibyte sequence was matched.
(See https://savannah.gnu.org/bugs/?45579 for a test case.)
Also, this will make it possible to search for invalid sequences.
(Currently it isn't possible to enter a search string with invalid
characters, but... a user might edit the search history file. And
if pasting at the prompt is implemented, it will be trivial to enter
invalid sequences if you have a file that contains them.)
2016-08-06 11:10:39 +02:00
Benno Schulenberg
e38e2c634b
chars: don't persist when only one of the compared sequences is invalid
...
Persisting might lead to count 'n' reaching zero, which would mean that
the needle has matched, which is wrong when one of the strings contains
an invalid or incomplete multibyte sequence.
2016-08-06 10:34:38 +02:00
Benno Schulenberg
d80109dd5e
chars: properly compare strings of different lengths
...
That is: don't run towlower() on the two differing bytes when having
reached the end of one of the strings.
This fixes https://savannah.gnu.org/bugs/?48700 .
In the bargain, don't do the conversion to lowercase twice.
Furthermore, persist when encountering invalid byte sequences --
until finding bytes that differ.
2016-08-05 16:07:55 +02:00
Benno Schulenberg
b305911cba
chars: straighten out the flow of a loop, so it is easier to follow
2016-08-04 13:40:55 +02:00
Benno Schulenberg
d60f95137e
chars: remove a special case that never occurs
...
The needle is never part of the hay -- it is always a separate string.
(And even if needle and haystack were identical, the routine works fine,
the case does not need special treatment.)
2016-08-04 13:40:19 +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
20058a1b63
spelling: don't consider digits as word parts, because GNU spell doesn't
...
This fixes https://savannah.gnu.org/bugs/?48660 .
2016-08-03 12:43:57 +02:00
Benno Schulenberg
f6dd0ad18a
tweaks: compile a parameter unconditionally
...
Straightforward code is more important than the tiniest possible binary.
Also adjust some comments and rename a variable.
2016-08-02 17:30:58 +02:00
Benno Schulenberg
a7ae1766c0
locking: remove any lock files when dying
...
This fixes https://savannah.gnu.org/bugs/?48675 .
2016-08-02 17:30:40 +02:00
Benno Schulenberg
faa46a3c71
screen: remove redundant redrawings of the entire edit window
...
(It may have been necessary in the past; there is no need for it now.)
This fixes https://savannah.gnu.org/bugs/?48633 .
2016-08-01 19:41:13 +02:00
Benno Schulenberg
03b168d0e3
tweaks: restore earlier conditions to prevent superfluous redrawings
...
When doing an <Up> on the top line, or a <Down> on the bottom line of
the edit window, the affected lines have already been redrawn by the
scrolling code, so there is no need to do that again.
(However, that does not prevent the second line (or the last-but-one
line) from being redrawn unnecessarily when using the M-- (or M-+)
command elsewhere on the screen and /that/ line is horizontally
scrolled. But we'll let that pass for now.)
2016-08-01 19:41:13 +02:00
Benno Schulenberg
2f6647687a
tweaks: rename a function, and adjust some comments
2016-08-01 19:41:13 +02:00
Benno Schulenberg
c9e9964207
screen: don't look at placewewant but at where we actually were and are
...
For horizontal scrolling, it is not the /desired/ column position that
is relevant for determining whether a line needs to be redrawn after a
cursor movement, but the /actual/ column positions before and after.
This fixes https://savannah.gnu.org/bugs/?48627 ,
and fixes https://savannah.gnu.org/bugs/?48629 .
2016-08-01 19:41:13 +02:00
Benno Schulenberg
0a3a6441bc
tweaks: unconditionally compile a couple of parameters
...
Having two unneeded parameters in the tiny version is acceptable --
the code gets so much more readable.
2016-08-01 19:41:13 +02:00
Benno Schulenberg
2eafe7bf58
files: make allowances for 32-bit PIDs
...
This addresses https://bugs.debian.org/831636 reported by Christoph Biedl.
2016-08-01 16:24:05 +02:00
Benno Schulenberg
08c51cfd45
input: ingest as verbatim just one control code or one or two escapes
...
Leave the rest of any escape sequence to be processed normally, which
should be possible because those characters are all in ASCII range.
This fixes https://savannah.gnu.org/bugs/?48318 .
2016-08-01 14:47:02 +02:00
Benno Schulenberg
b472f5a633
tweaks: remove some unnecessary keycodes from a switch statement
...
These codes are the basic codes that get assigned for the movement keys
in the list of shortcuts -- they don't need any translation.
2016-08-01 14:07:21 +02:00
Benno Schulenberg
5806bf5249
tweaks: normalize some whitespace and adjust several comments
2016-08-01 14:05:42 +02:00
Benno Schulenberg
90a90365a8
tweaks: rename three constants, for clarity, and hardcode two others
2016-08-01 12:56:05 +02:00
Benno Schulenberg
9cd30d4917
tweaks: don't bother setting meta_key to false when a key is invalid
...
That is a task for the key-getting routine.
2016-07-31 18:32:18 +02:00
Benno Schulenberg
f33d8cae30
tweaks: don't use a function call when reference to the variable will do
2016-07-31 18:30:53 +02:00
Benno Schulenberg
e471e2d462
tweaks: move the modified editing keys again
2016-07-31 18:29:57 +02:00
Benno Schulenberg
fe38b78486
tweaks: adjust indentation after the previous changes
2016-07-31 18:22:07 +02:00
Benno Schulenberg
1af1f5c9f4
tweaks: return quicker from the key parsing routine
2016-07-31 18:19:17 +02:00
Benno Schulenberg
b9e83fe9f8
tweaks: move some debugging stuff, and move modified editing keys too
...
Again, just for preapring an easier return from the parsing routine.
2016-07-31 18:17:06 +02:00
Benno Schulenberg
cb10b2b908
tweaks: elide the global variable 'func_key'
...
There is no need to specially flag a function key or editing key --
the keycode is indication enough in itself: outside of byte range.
2016-07-31 18:13:05 +02:00
Benno Schulenberg
19dfd20a88
tweaks: add a variable, in preparation for making returning easier
2016-07-31 18:10:31 +02:00
Benno Schulenberg
d12fdda15b
tweaks: replace a three-case switch with an if and an else
2016-07-31 18:10:01 +02:00
Benno Schulenberg
3930a697e8
tweaks: consistently use a parameter instead of a struct element
2016-07-30 13:05:52 +02:00
Benno Schulenberg
9322e1e6a4
tweaks: reshuffle two ifs for a little more speed
...
Saving roughly twenty microseconds at startup.
2016-07-30 13:04:06 +02:00
Benno Schulenberg
b70fe38eab
tweaks: normalize some indentation
2016-07-30 12:24:35 +02:00
Benno Schulenberg
1c528db8da
tweaks: condense three asserts into a single one
...
Also, when a key string does not denote a Ctrl nor Meta nor Function key,
there is no point in assigning a keycode, because plain characters cannot
be used as a function shortcut.
2016-07-30 12:24:35 +02:00
Benno Schulenberg
1c9ab8bf16
tweaks: rename a struct element, to be more fitting
...
The keycode is not a sequence; it is a single integer value.
2016-07-30 12:24:35 +02:00
Benno Schulenberg
e295070193
shortcuts: group the setting of key string and keycode into one function
...
And instead of using two key types, just use a bool to indicate whether
a keystroke involves Meta.
2016-07-30 12:21:42 +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
5b0ab8be62
shortcuts: remove any unnecessary classifying of keys
...
After initialization, the type of a key is never used nor needed
(other than for meta keys).
2016-07-30 12:13:47 +02:00
Benno Schulenberg
ecef093def
tweaks: adjust indentation after previous changes
2016-07-29 09:33:28 +02:00
Benno Schulenberg
6d6f5bd4a7
tweaks: check earlier on for sufficient length of the sequence
2016-07-29 09:33:28 +02:00
Benno Schulenberg
e3dbffc9f7
input: be more strict in recognizing certain escape sequences
...
Accept the "Esc [ 1 n ~" and "Esc [ 2 n ~" sequences only when they
end with the "~" character, not with any character.
2016-07-29 09:33:28 +02:00
Benno Schulenberg
2225d54126
input: don't use a function call when a literal value will do
2016-07-29 09:33:28 +02:00
Benno Schulenberg
9115828e76
input: fix a pasto from eight years ago, from commit e347efb
2016-07-29 09:33:16 +02:00
Benno Schulenberg
992533b91e
moving: don't do an automatic smart home with Ctrl+Up and Ctrl+Down
...
It is nicer to have a predictable cursor position and not see it hop
left and right on differently indented lines.
2016-07-28 09:09:51 +02:00
Benno Schulenberg
f3e8991206
credits: don't bother blanking the second line nor the help lines
...
Those lines don't exist in that mode -- the relevant subwindows are
smaller, or have been made smaller just before.
2016-07-27 12:40:11 +02:00
Benno Schulenberg
df7353b312
tweaks: compute the sizes of the subwindows in a more direct manner
2016-07-27 12:27:04 +02:00
Benno Schulenberg
f311c0af87
tweaks: adjust a couple of comments
2016-07-27 09:23:49 +02:00
Benno Schulenberg
c88fae3310
search: match a beginning-of-line anchor just once per line
...
This fixes https://savannah.gnu.org/bugs/?48635 .
2016-07-27 09:04:06 +02:00
Benno Schulenberg
68cfb08888
tweaks: fix compilation with --enable-tiny
2016-07-25 17:29:24 +02:00
Benno Schulenberg
4cff67fdde
tweaks: adjust indentation after the previous change, and edit comments
2016-07-25 12:50:03 +02:00
Benno Schulenberg
aefe26d216
tweaks: factor out a common condition
2016-07-25 12:31:40 +02:00
Benno Schulenberg
8eb99e2a1d
tweaks: put similar things together
2016-07-25 12:18:40 +02:00
Benno Schulenberg
19b6f906cc
tweaks: rename another variable, for aptness
2016-07-25 10:57:33 +02:00
Benno Schulenberg
c38ffdc741
tweaks: rename two variables, to match others
2016-07-25 10:53:49 +02:00
Benno Schulenberg
a472f480a7
tweaks: trim some comments, and simplify a condition
2016-07-24 13:44:16 +02:00
Benno Schulenberg
4416d9c941
tweaks: shuffle the resetting of a counter to the tail of the routine
2016-07-24 13:15:45 +02:00
Benno Schulenberg
c073c5ae54
tweaks: don't bother resetting the Unicode code holder
...
It will be initialized when a new code is started.
2016-07-24 13:09:24 +02:00
David Lawrence Ramsey
fc0ddab349
input: provide feedback on the Unicode digits typed so far
...
This fulfills https://savannah.gnu.org/bugs/?48154 .
2016-07-24 12:19:42 +02:00
Benno Schulenberg
c6dbcf91c3
new feature: functions to jump to previous or following block of text
...
And hard-bind the keys Ctrl+Up and Ctrl+Down to these functions.
Unlike the paragraph-jumping code, these new functions disregard
any indentation, treating only blank lines as separators. They
also do an automatic smart home when that option is set.
This fulfills https://savannah.gnu.org/bugs/?48291 .
2016-07-24 12:00:00 +02:00
Benno Schulenberg
8c7a38596d
screen: include a workaround only when compiling against older ncurses
...
The bug with a leading wide character has been fixed since ncurses-5.9.
See https://savannah.gnu.org/bugs/?31743 for reference.
2016-07-24 10:38:31 +02:00
Benno Schulenberg
1c2d2a4027
tweaks: adjust a comment for removed definitions
2016-07-22 15:57:20 +02:00
Benno Schulenberg
1e5614b31b
tweaks: avoid two compiler warnings
2016-07-22 15:48:06 +02:00
Benno Schulenberg
04b9b9c78b
tweaks: avoid a runtime error when compiled with -fsanitize=undefined
...
This fixes https://savannah.gnu.org/bugs/?48540 .
2016-07-22 15:39:45 +02:00
Benno Schulenberg
41ad376b70
chars: plug a gushing memory leak
2016-07-22 15:30:09 +02:00
Rishabh Dave
4c566c7903
tweaks: reduce the number of wattron/wattrof calls
...
Also, compose the coloring attributes during initialization
instead of every time when painting something.
Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-07-21 10:10:59 +02:00
Benno Schulenberg
73a07215cc
debug: remove duplicate information
2016-07-21 09:54:07 +02:00
Benno Schulenberg
bf091be778
chars: don't try to see a character in an empty line
...
This fixes https://savannah.gnu.org/bugs/?48578 .
2016-07-21 09:46:47 +02:00
Benno Schulenberg
103dd06347
input: don't crash when the window is resized during verbatim input
...
Instead of referring to a window that might have been deleted by a
resize, just turn the keypad back on for the two windows from which
input might have been requested.
Also: don't insert KEY_WINCH as the verbatim keystroke.
This fixes https://savannah.gnu.org/bugs/?48532 .
2016-07-17 12:18:12 +02:00
Benno Schulenberg
1d4c1e0bfc
input: plug a memory leak
...
This fixes https://savannah.gnu.org/bugs/?48538 .
2016-07-17 12:00:33 +02:00
Benno Schulenberg
b3fbb7c7ff
input: report keystroke M-[ as being unbindable instead of just unbound
2016-07-16 14:05:33 +02:00
Benno Schulenberg
225203d40d
tweaks: correct a comment
2016-07-16 13:29:50 +02:00
Benno Schulenberg
c2a0c78d9b
tweaks: rename a variable and a type, to be less confusing
2016-07-16 13:29:50 +02:00
Benno Schulenberg
ef071255e5
color: refresh the screen whenever the active syntax changes
...
This fixes https://savannah.gnu.org/bugs/?47296 .
2016-07-14 17:51:33 +02:00
Benno Schulenberg
afb6a5b86d
color: forget about aborting the precalculation for multiline regexes
...
This fixes https://savannah.gnu.org/bugs/?48389 .
2016-07-14 14:31:14 +02:00
Benno Schulenberg
a37cd9f0ef
tweaks: rename a variable, to clarify it refers to columns, not to bytes
2016-07-14 14:28:15 +02:00
Benno Schulenberg
6f12992cea
new feature: add the option --wordchars, to set extra word characters
...
This allows the user to specify which other characters, besides the
default alphanumeric ones, should be considered as part of a word, so
that word operations like Ctrl+Left and Ctrl+Right will pass them by.
Using this option overrides the option --wordbounds.
This fulfills https://savannah.gnu.org/bugs/?47283 .
2016-07-13 20:49:30 +02:00
Benno Schulenberg
d88423eaae
tweaks: move a debug statement to its proper place, and improve aspect
2016-07-13 20:48:03 +02:00
Benno Schulenberg
8b28de1313
tweaks: don't call a thing malloc... when it doesn't call malloc()
2016-07-13 15:04:40 +02:00
Rishabh Dave
8fa72fb7e7
browser: elide a variable by fusing the uses of 'newpath' and 'path'
...
Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
2016-07-13 14:30:18 +02:00
Benno Schulenberg
b4babc2036
input: accept only the four iTerm sequences that actually get handled
...
This fixes https://savannah.gnu.org/bugs/?48455 .
2016-07-13 13:01:46 +02:00
Benno Schulenberg
f2150d3f98
input: treat Ctrl+Alt+key different from Esc followed by Ctrl+key
...
When the user changes her mind after having pressed Esc, she cannot
unpress Esc, so do that for her by ignoring the escape code when
the subsequent keycode is outside of the normal printable range.
This restores the behavior from before nano-2.3.5 -- except that
Ctrl+Alt+key continues to report an unbound key.
This fixes https://savannah.gnu.org/bugs/?48459 .
2016-07-13 10:01:07 +02:00
Benno Schulenberg
033376aec0
input: consider only O, o and [ as starters of multi-character sequences
...
This prevents many keycode sequences from being misconstrued when a
command key plus other keystrokes accumulate in the input buffer.
This fixes https://savannah.gnu.org/bugs/?48395 .
2016-07-13 09:56:24 +02:00
Benno Schulenberg
e33a0b6dbe
screen: avoid converting each character twice from multibyte to wide
2016-07-12 19:41:13 +02:00
Benno Schulenberg
0894587305
screen: elide another intermediate buffer for every visible character
2016-07-12 19:30:50 +02:00
Benno Schulenberg
960e848cc7
tweaks: elide a typedef, as it now has just one element
2016-07-12 09:35:48 +02:00
Benno Schulenberg
b4737072a6
tweaks: delete an element that is always FALSE and never used
2016-07-12 09:24:32 +02:00
Benno Schulenberg
8507dd4bd0
color: integrate the hilite attribute into the pair number
...
Color-pair numbers and attributes can be OR'd together -- do so,
to save an attron() call whenever the hilite is on.
2016-07-12 09:20:09 +02:00
Benno Schulenberg
62eeda3e9f
tweaks: use mallocstrcpy() instead of strdup(), for a graceful death
...
To make nano save its modified buffers when it runs out of memory.
2016-07-11 20:45:26 +02:00
Benno Schulenberg
06c806215e
tweaks: improve two comments
2016-07-11 20:11:29 +02:00
Benno Schulenberg
d2b25120f0
tweaks: fuse two handlings of a delete key, and fix a comment
2016-07-10 21:36:25 +02:00
Benno Schulenberg
0c319f8b4b
tweaks: put the case labels (the keycodes) in a more sensible order
2016-07-10 20:49:52 +02:00
Benno Schulenberg
4fcc760158
tweaks: put some case labels closer to their statements
...
Also condense some comments, and group keys with the same result together.
2016-07-10 20:38:08 +02:00
Benno Schulenberg
0d5f918453
input: add some missing keycodes to the parsing routine
...
Add them so that <Esc> followed by <Home> will simply do "Home" instead of
reporting an unbound key. The same for <End>, <PageUp> and <PageDown>.
This restores the behavior from before nano-2.3.5.
2016-07-10 20:21:11 +02:00
Rishabh Dave
9c7940b599
utils: accept mistypings and common separators between line and column
...
It is easy to type beside the comma key and hit instead "m" or ".", so
accept also these as a separator between line and column number. And
when being generous anyway, also accept space, slash and semicolon.
This fulfills https://savannah.gnu.org/bugs/?48305 .
Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
2016-07-04 22:04:24 +02:00
Benno Schulenberg
ccfb1eb0f1
tweaks: rearrange a function in my style, and rename a variable
2016-07-04 21:50:12 +02:00
Benno Schulenberg
7e3a9c3aa6
utils: don't bother to check line and column for NULL
...
When parsing a line and a column number, of course the found values
need to be passed back, otherwise it would be pointless to parse them.
2016-07-04 21:42:04 +02:00
Benno Schulenberg
a730b25ef9
browser: elide another call of opendir()
...
And in the bargain show an error message when doing ^R unreadabledir ^T.
2016-07-04 21:18:09 +02:00
Benno Schulenberg
500fef8314
tweaks: rename a variable -- to match others and to be more concise
2016-07-04 13:43:19 +02:00
Benno Schulenberg
29986e95a0
input: don't drop the first byte when user starts typing during loading
...
Precalculation of the multiline color data can be cut short when the
user is impatient and starts typing. But this would drop the first
byte of whatever was typed -- not nice when it was just plain text,
but surprising and worse when the first keystroke was a command.
This fixes https://savannah.gnu.org/bugs/?48388 .
2016-07-04 09:27:35 +02:00
Benno Schulenberg
4af1da7d95
color: push the resets further when start and end match are equal
...
When for a multiline syntax-coloring rule the starting regex matches at
the exact same spot as the ending regex, do a second round of resets, so
that reevaluation starts further back and gets a few more things right.
This mildly fixes https://savannah.gnu.org/bugs/?47420 .
2016-07-03 16:23:54 +02:00
Benno Schulenberg
528b79b5f3
tweaks: rename a variable to be more accurate
...
When we get a ^J as verbatim input, it is not possible to include it
into the file buffer or the prompt answer, because this would mean
adding an encoded null to the buffer or answer, and that is not what
the user intended. One option would have been to simply ignore a ^J
in verbatim input. But the choice has been made to act the same way
as when the ^J (0x0A) is found in the file data: start a new line.
That is the same response as to the Enter key, yes -- but the code
for the Enter key is ^M (0x0D), not ^J. So, to be more precise,
rename the relevant variable from 'got_enter' to 'got_newline'.
2016-07-03 16:19:27 +02:00
Benno Schulenberg
03a81aa9c5
browser: trim all trailing slashes (just in case there are more)
2016-07-03 16:18:26 +02:00
Rishabh Dave
4957c1121d
browser: select an inaccessible directory also when tabbed
...
When the user tab-completed a name at the Go To Directory prompt, this
name will end in a slash. Remove this slash, so the name can be found
in the file list (where directory names don't include the final slash).
This fixes http://savannah.gnu.org/bugs/?48353 .
Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
2016-07-02 12:26:42 +02:00
Benno Schulenberg
d9d8eb2480
tweaks: straighten out the flow of a loop
2016-07-01 13:11:23 +02:00