Benno Schulenberg
372bd0f7dd
screen: switch the cursor back on only in the main loop
...
This fixes https://savannah.gnu.org/bugs/?49750 .
2016-12-03 18:03:11 +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
c9680b8b64
input: add the shifted PageUp and PageDown keycodes produced by VTE
...
Modern VTE-based terminals now produce codes for those keys and
no longer swallow them when nano is active.
This addresses https://savannah.gnu.org/bugs/?49746 .
2016-12-01 17:34:57 +01:00
Benno Schulenberg
656563beda
screen: don't restore the previous menu after a yesno prompt
...
There is no need for that -- it just causes flicker.
This fixes https://savannah.gnu.org/bugs/?49742 .
2016-12-01 15:54:56 +01:00
Benno Schulenberg
8f95f9b1aa
tweaks: reshuffle three initializations and trim some comments
2016-12-01 15:28:59 +01:00
Benno Schulenberg
c6512a9717
screen: don't request an update of the edit window for every yesno prompt
...
Only when doing replacements does the edit window need a refresh: for
every new spotlight. So, do the update request in the latter routine.
2016-12-01 15:20:05 +01:00
David Lawrence Ramsey
b5400ffe65
general: gettextize three overlooked statusbar messages
...
This fixes https://savannah.gnu.org/bugs/?48622 .
2016-12-01 13:02:43 +01:00
Benno Schulenberg
ac41587d4e
oops: the yesno prompt for replacing does not want a visible cursor
2016-11-30 13:47:50 +01:00
Benno Schulenberg
e4b8d6fab5
tweaks: remove a bit of obscuring conditional compilation
2016-11-30 11:46:05 +01:00
Benno Schulenberg
72e8bcb027
tweaks: move a switching on of the cursor to a more logical place
2016-11-30 11:11:06 +01:00
Benno Schulenberg
7401670d58
tweaks: fix compilation when configured with --enable-tiny
2016-11-30 11:05:07 +01:00
David Lawrence Ramsey
e4d452424b
files: give feedback when restricted mode prevents overwriting a file
...
Achieve this by reusing the code that gives feedback when trying to
save a buffer while using --tempfile and the file has no name yet.
This fixes https://savannah.gnu.org/bugs/?48622 .
2016-11-29 12:08:39 +01:00
David Lawrence Ramsey
d48071b2b2
input: properly check the full escape sequences for all keys
...
Also for Delete, End, PageUp and PageDown (on some terminals)
the last byte in the sequence needs to be checked.
This fixes https://savannah.gnu.org/bugs/?49710 .
2016-11-27 20:31:12 +01:00
Benno Schulenberg
c1a484270b
rcfile: actually avoid opening directories and devices
...
Achieve this elegantly by factoring out the reading of one rcfile.
2016-11-27 18:21:04 +01:00
Benno Schulenberg
981a1d39bf
tweaks: factor out a small function
2016-11-27 17:30:53 +01:00
Benno Schulenberg
925a001658
rcfile: check the vital shortcuts just once, not for every included file
2016-11-27 16:40:54 +01:00
Benno Schulenberg
77023a749b
tweaks: remove an annoying conditional compilation of an argument
...
Also remove some unneeded prototypes, adjust some comments, and
move a constant definition to the top of the file.
2016-11-27 16:34:34 +01:00
Benno Schulenberg
1762920808
rcfile: actually don't try to open things that cannot be syntax files
2016-11-26 17:48:31 +01:00
Benno Schulenberg
281a56fb74
tweaks: reshuffle some things in a more linear manner
...
Also improve or correct some comments.
2016-11-26 17:42:27 +01:00
Benno Schulenberg
592d0d6c9a
files: trying to open a non-existent file will never succeed
...
If it would, the returned file descriptor would make nano crash,
because the corresponding stream has not been opened. And when
returning zero instead (as the code did originally), nano would
open an empty buffer, although it claims to be reading the file.
In short: I think this is a leftover of an attempted fix of
https://savannah.gnu.org/bugs/?25297 , from commit 2823c99
.
2016-11-26 17:00:41 +01:00
Benno Schulenberg
3cc561e36e
input: distinguish <Shift+Home> from <Home> on an rxvt terminal
...
That is: when --rebindkeypad is in effect -- without this option
they were already getting distinguished.
2016-11-26 12:25:36 +01:00
Benno Schulenberg
0333b87ad7
input: distinguish <Alt+Left> from <Alt+Right> on an rxvt terminal
...
Both would jump a word to the left -- now each jumps a word in the
proper direction.
2016-11-26 12:07:33 +01:00
David Lawrence Ramsey
059c8efb44
input: make Shift+Alt+Arrow work properly on rxvt and Eterm terminals
...
This fixes https://savannah.gnu.org/bugs/?49636 .
2016-11-26 11:57:39 +01:00
Benno Schulenberg
eb5968f845
startup: activate restricted mode earlier, so --help will reflect it
...
Kind-of-discovered-by: Markus Bergholz <markuman@gmail.com>
2016-11-17 18:05:09 +01:00
Benno Schulenberg
f2c72bf759
binding: always initialize some keycode variables to a standard value
...
Also when somehow key_defined() is missing.
This fixes https://savannah.gnu.org/bugs/?49614 .
Reported-by: Mike Frysinger <vapier@gentoo.org>
2016-11-17 17:32:28 +01:00
Benno Schulenberg
ed165827bc
screen: don't hide the cursor when --constantshow is used
...
(Bug was introduced yesterday, by commit a4132e2.)
2016-11-13 20:00:31 +01:00
Benno Schulenberg
65bf36baa5
rcfile: let a 'set fill' reenable hardwrapping
...
Otherwise the user can override a 'set nowrap' in /etc/nanorc only
via the command line.
This fixes https://savannah.gnu.org/bugs/?49593 reported by Shirish.
2016-11-13 19:47:15 +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
a4132e2e64
screen: do a refresh before changing the value of 'focusing'
...
This fixes https://savannah.gnu.org/bugs/?49530 .
2016-11-12 18:02:03 +01:00
Benno Schulenberg
33bc848c5b
binding: properly conditionalize the UTF-8 parts
...
Reported-by: Sumedh Pendurkar <sumedh.pendurkar@gmail.com>
2016-10-29 10:19:28 +02:00
Benno Schulenberg
4c476bc872
scrolling: use a comparison that will work also in softwrap mode
...
This fixes https://savannah.gnu.org/bugs/?49467 .
2016-10-28 11:38:58 +02:00
Benno Schulenberg
9c2e270b3e
softwrap: initialize 'editwincols' early, for computing the number of wraps
...
When giving a line number on the command line, do_gotolinecolumn() needs
to know the width of the screen to be able to (roughly) place the target
line in the center of the screen.
This fixes https://savannah.gnu.org/bugs/?49462 .
2016-10-28 10:50:06 +02:00
Benno Schulenberg
0eef5610eb
files: mark a new buffer as modified after inserting command output
...
This fixes https://savannah.gnu.org/bugs/?49423 .
2016-10-27 20:05:05 +02:00
Benno Schulenberg
2a55d2b29a
tweaks: adjust some comments and reduce the scope of some variables
...
Also remove some cluttering conditional compilation.
2016-10-27 20:04:50 +02:00
Benno Schulenberg
5416b9c09d
tweaks: remove a band-aid condition that is no longer needed
...
Also, don't bother conditionalizing two booleans for the tiny version.
2016-10-27 20:00:01 +02:00
Benno Schulenberg
7287300e0d
tweaks: compile two parameters unconditionally
2016-10-27 12:24:41 +02:00
Benno Schulenberg
ffeb0f9d4b
tweaks: don't spread a statement over multiple lines unnecessarily
2016-10-27 11:41:49 +02:00
Benno Schulenberg
10c9093942
general: add the option -g/--showcursor, to match Pico
...
The nanorc option already exists, but not the corresponding one
for the command line.
2016-10-27 11:34:41 +02:00
Benno Schulenberg
b38cbfe173
startup: always initialize 'margin' and 'editwincols'
...
This fixes https://savannah.gnu.org/bugs/?49428 .
2016-10-24 17:40:06 +02:00
Benno Schulenberg
702b09c859
tweaks: elide a parameter that is always FALSE
2016-10-23 20:07:39 +02: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
55b1403542
tweaks: adjust some whitespace and a comment
2016-10-23 17:26:19 +02:00
Benno Schulenberg
9d5ee16614
tweaks: don't bother redrawing some lines when whole screen will be redrawn
2016-10-23 17:26:19 +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
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