Commit Graph

499 Commits (1c528db8dace5c25f444392d52e455bd25954d23)

Author SHA1 Message Date
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 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 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 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 960e848cc7 tweaks: elide a typedef, as it now has just one element 2016-07-12 09:35:48 +02:00
Benno Schulenberg 9106cc8ecc main: let the main loop restore the main menu, if needed
Don't make it the responsibility of the executed functions to restore
the list of shortcuts of the edit window.  Just detect whether another
menu was displayed, and if so, redisplay the main menu.
2016-06-21 11:03:38 +02:00
Mike Scalora 6a2032f5b0 new feature: comment/uncomment current line or selected lines
This allows for commenting or uncommenting a line or a bunch of lines
with a single keystroke (default binding: M-3).  The characters used
for commenting/uncommenting are specified by the active syntax file.

Reviewed-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Mike Scalora <mike@scalora.org>
2016-05-25 22:29:50 +02:00
Benno Schulenberg c8f530af93 statusbar: add a non-beeping message type that does not get overwritten
Error messages about lock files should not get overwritten by purely
informational messages, only by alerting ones.

This fixes https://savannah.gnu.org/bugs/?47963.
2016-05-21 13:58:09 +02:00
Benno Schulenberg eedec06cc4 tweaks: fix compilation when configured with --enable-tiny --enable-browser 2016-05-17 12:48:47 +02:00
Benno Schulenberg cdcd365d34 tweaks: normalize some whitespace 2016-05-17 11:33:21 +02:00
Benno Schulenberg 2535f51e01 statusbar: prevent error messages from overwriting each other
If during startup there are multiple error messages, currently only the
last one remains and can be read.  To improve on that, introduce a short
pause between error messages -- even if it's not enough to read them all,
at least the user will be aware that there are multiple ones.

This also causes a few error messages to beep that currently don't beep,
such as when a file is unwritable.
2016-05-16 18:03:07 +02:00
Benno Schulenberg 36df5ceef6 browser: make Ctrl+Left and Ctrl+Right jump to left and right column 2016-05-16 17:01:45 +02:00
Benno Schulenberg 3d82986725 help: add an extra blank line to the lists of searching shortcuts
To separate things that have little to do with each other.
2016-05-16 16:55:11 +02:00
Benno Schulenberg 71e452aef2 screen: improve the conditional placement of a help-line item
When compiled with --disable-justify, try to keep the vertical pairing
of related items.
2016-05-16 16:34:07 +02:00
Benno Schulenberg 338807a327 help: bring some air into the lists of shortcuts, giving the eye a hold 2016-05-05 13:27:07 +02:00
Benno Schulenberg 318ed6b105 scrolling: center the cursor when inserted stuff does not fit on screen
Since nano-2.4.1, reading in or pasting a large piece of text would put
the cursor on the bottom line, leaving only one line of the non-read or
non-pasted text visible.  This is different from the centering behavior
of Pico, and somewhat disorienting, as you can't see "where you are" any
more in relation to the file as it was.

So now center the cursor whenever the read or pasted text is larger than
the screen, but don't center it when the text fits entirely on the screen.
(The latter avoids the effect of the screen jumping unnecessarily when
inserting just a few lines while the cursor is near the bottom.)

To achieve this behavior: default to focusing, and temporarily set it to
FALSE when the focusing effect is unwanted.

This fixes https://savannah.gnu.org/bugs/?47841.
2016-05-04 10:13:36 +02:00
Benno Schulenberg e21e954742 browser: add a binding for the refresh function
And make the function actually refresh the list.  Useful for when files
have been added or deleted since opening the browser.
2016-05-02 12:00:56 +02:00
Benno Schulenberg e2556274f7 browser: provide tab completion also outside of the working directory
Add a global variable, 'present_path', so that 'cwd_tab_completion()'
knows where the user is in the browser, so that it can try completions
against names in that directory instead of always against names in the
current working directory (where nano was invoked).

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

Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-05-02 12:00:18 +02:00
Benno Schulenberg 53f4a9f5a8 screen: rename 'edit_refresh_needed' to 'refresh_needed'
For a little contrast with the function edit_refresh() -- it's
annoying that when you search for the latter you get to see all
the settings of the flag too.
2016-04-25 21:14:18 +02:00
Benno Schulenberg d92eb4fee3 all: eradicate SVN's $Id$ tags 2016-04-05 14:59:12 +02:00
Benno Schulenberg 51743233ed Removing the 'last_replace' variable that is never used.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5768 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-28 19:14:33 +00:00
Benno Schulenberg 8a244c607a Renaming three variables.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5709 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-04 20:22:27 +00:00
Benno Schulenberg 90f1ccf9ac Eliding the now too tiny function free_list_item().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5708 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-04 18:28:03 +00:00
Benno Schulenberg c02c182bd7 Deleting a now-unused struct member.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5707 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-04 17:04:56 +00:00
Benno Schulenberg a24aee417d Renaming a struct member.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5697 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-29 09:17:03 +00:00
Benno Schulenberg 07441adb14 Renaming another struct element, because it refers not just
to file extensions, but also to header lines and magic strings.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5690 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-26 20:19:13 +00:00
Benno Schulenberg 3522751c6b Renaming a struct element for aptness and contrast.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5689 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-26 20:09:29 +00:00
Benno Schulenberg 818a39cfb9 Condensing some code by factoring out a repetition.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5659 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 09:34:33 +00:00
Benno Schulenberg f4f9954556 Eliding the function free_openfilestruct() as it is used only once.
(Note that openfile cannot be NULL here.  And in case it is,
nano should crash because DEBUG is enabled.)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5658 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 09:02:58 +00:00
Benno Schulenberg 814a4220a2 Removing four unneeded checks for NULL.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5657 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-21 20:54:04 +00:00
Benno Schulenberg cca22bb10a Guiding the translators a little bit.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5607 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-05 12:27:54 +00:00
Benno Schulenberg 5a5144b75a Putting four strings in the standard order: first backward, then forward.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5606 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-05 12:01:02 +00:00
Benno Schulenberg fe3d849a75 Getting rid of a global variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5574 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-20 15:56:40 +00:00
Benno Schulenberg 8bd76d8302 Verifying that the containing directory of the given filename exists.
Original patch by Rishabh Dave, edited by Benno.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5572 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-20 15:14:52 +00:00
Benno Schulenberg a3a69eec02 Fixing a typo in an #ifndef symbol. Reported by Frank.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5569 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-17 16:25:31 +00:00
Benno Schulenberg 34fbb1f4de Adjusting a few comments and rewrapping some lines.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5556 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-13 20:32:40 +00:00
Benno Schulenberg deb271d708 Differentiating a variable name from function names.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5551 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-12 19:20:40 +00:00
Benno Schulenberg 1ac2c4cd4f Adding a comment and using a symbolic value.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5537 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-07 15:42:44 +00:00
Benno Schulenberg 6d6cda24c8 Delete two unneeded #ifdefs -- better fail to compile than create a cripple.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5536 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-07 15:21:59 +00:00
Benno Schulenberg 9962e3b65c Making "Tab" produce the appropriate keycode.
This fixes Savannah bug #46812.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5535 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-04 19:42:37 +00:00
Benno Schulenberg 22557df600 Adding "Tab" as a key description, just like "Del" and "Enter" already are.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5533 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-04 10:50:21 +00:00
Benno Schulenberg dd29c56993 Rewriting the loop, and constifying the input of sctofunc().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5530 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-04 09:52:43 +00:00
Benno Schulenberg 7a08fa63f5 No longer freeing any existing functions -- they are defined only once.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5529 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-04 09:44:35 +00:00
Benno Schulenberg 539a4b42be Constifying the input parameter of strtosc() and strtomenu().
Patch by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5528 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-04 09:12:21 +00:00
Benno Schulenberg 8cc6308f9c Offering ^Q in the writeout menu to close and discard the current buffer
without saving it.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5509 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-23 16:34:44 +00:00
Benno Schulenberg f08d79d204 Making Ctrl+Left and Ctrl+Right work on more terminals by asking
ncurses for the keycodes.  This addresses Debian bug #800681.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5434 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-23 08:52:23 +00:00
Benno Schulenberg bde996db67 Discarding a now useless function.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5403 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-11 19:56:35 +00:00
Benno Schulenberg 4a23a171b8 Allowing to exit the file browser with the same key as it was entered: ^T.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5396 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-08 19:40:13 +00:00