Commit Graph

482 Commits (a7c158d07d8fdebcac68b1254a5b09df07fbe61e)

Author SHA1 Message Date
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
Benno Schulenberg 53fbcf77f2 Not checking whether a function has a help line; it's irrelevant.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5392 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-06 20:25:05 +00:00
Benno Schulenberg f811846dc5 Allowing to change the file format in restricted mode, but actually disabling
Appending, Prepending, making Backups, and opening the File Browser.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5357 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-13 19:29:55 +00:00
Benno Schulenberg 90798fbfba Allowing to toggle whitespace display also when support for nanorc files
has not been built in, since the default values are quite usable.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5348 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-09 16:05:50 +00:00
Benno Schulenberg b3e4051ded Adding two new bindable functions which delete all characters
from the cursor to the preceding or succeeding word start.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5334 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-31 11:52:26 +00:00
Benno Schulenberg b7f7df93df Changing "Justify" to a tag and regrouping a couple.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5332 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-30 19:51:08 +00:00
Benno Schulenberg 104ea6b0c3 Normalizing whitespace after the preceding changes.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5330 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-30 11:29:45 +00:00
Benno Schulenberg 2ee18d635f Not showing ^R and ^T in the help lines in restricted mode (if possible),
to give visual feedback.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5329 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-30 10:37:28 +00:00
Benno Schulenberg f7e8861770 Tweaking a string, to match the --help text.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5321 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-26 09:29:42 +00:00
Benno Schulenberg 4990f74f83 Adding two new bindable functions that repeat the last search command
in a fixed direction without prompting.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5320 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-26 09:23:24 +00:00
Benno Schulenberg ee7b095678 Adding a new bindable function that writes a file to disk without
first asking for its name.  Patch was suggested by Seiya Nuta.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5318 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-25 19:25:50 +00:00
Benno Schulenberg 474b390816 Plugging a few memory leaks.
Patch by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5314 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-22 18:02:36 +00:00
Benno Schulenberg 1f866c29db Renaming the 'menu' item to 'menus' in the shortcut struct.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5301 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-15 20:13:05 +00:00
Benno Schulenberg 5ac6a87522 Giving each toggle a sequence number, to be able to show them in a fixed order.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5282 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-06 17:51:17 +00:00
Benno Schulenberg 954f98c448 Removing a duplicate binding of ^T, to prevent it being shown twice.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5272 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-27 15:58:20 +00:00
Benno Schulenberg c32a58a826 Not checking for non-NULL before freeing a variable, as it's unnecessary.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5249 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-14 19:14:41 +00:00
Benno Schulenberg 75d64e677e Handling a SIGWINCH (which signals a change in window size) not when it
happens but only when checking for keyboard input.  It now reports the
SIGWINCH via a special key value to the calling routine, to allow not
only the main editor but also the help viewer and the file browser to
adapt their display to the new size.
Patch by Mahyar Abbaspour, somewhat edited by Benno.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5228 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-05-28 13:02:29 +00:00
Benno Schulenberg 1cf22d4d4f Initializing the search and replace strings in a central place.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5212 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-21 18:42:11 +00:00