Commit Graph

5585 Commits (17cf833b9c0631d933edcdd298099821c1634707)

Author SHA1 Message Date
Benno Schulenberg 17cf833b9c tweaks: normalize some whitespace 2016-05-30 09:09:36 +02:00
Benno Schulenberg aaab6e57e0 screen: when using positionlog, show as much of the file as possible
When opening a file that was edited before, and the remembered position
is near the end of the file, then don't center the target line but show
the last line of the file on the bottom line of the screen, thus showing
as much of the file content as possible.

This addresses https://savannah.gnu.org/bugs/?46243.
2016-05-28 21:20:39 +02:00
Benno Schulenberg fbd817fb94 utils: rename some variables, to match those in strnlenpt() 2016-05-28 13:23:41 +02:00
Benno Schulenberg e3e3f655ee tweaks: use an available macro to silence a compiler warning 2016-05-27 21:48:38 +02:00
Benno Schulenberg 3129ff687a tweaks: rename a variable, because nothing is returned there 2016-05-27 21:43:39 +02:00
Benno Schulenberg 1d3d30776a tweaks: more consistently use * instead of [0] when checking for '\0' 2016-05-27 21:31:55 +02:00
Benno Schulenberg 2fae87d9a5 tweaks: harmonize some indentations, elide an #ifdef, and rewrap a line 2016-05-27 21:22:56 +02:00
Benno Schulenberg a5b3f00d78 chars: make comparing multibyte strings twice as fast
Instead of parsing every multibyte character twice, first with
parse_mbchar() and then with mbtowc(), just let mbtowc() do all
the work.  This makes searching for a fixed string twice as fast.

This also gets rid of four variables and lots of memory allocations.
(And, more importantly: it stops nano messing up the internal state
of the multibyte-to-wide character conversion, and thus would make
the calls to mbtowc_reset() superfluous.)
2016-05-27 10:37:43 +02:00
Benno Schulenberg 1bffa17c01 tweaks: rename two more variables 2016-05-27 10:36:54 +02:00
Benno Schulenberg a151167416 tweaks: rename some variables for contrast 2016-05-27 10:36:12 +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 d3bd855c9d tweaks: rename a function, and move the sorting there too 2016-05-25 12:09:22 +02:00
Rishabh Dave bd3f156044 browser: move all openings and closings of a directory to the same function
Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-05-25 12:02:33 +02:00
Benno Schulenberg 3b21659661 tweaks: elide four #ifdefs, improve one comment and unwrap some others 2016-05-24 17:55:24 +02:00
Benno Schulenberg bf64386717 tweaks: rename a variable, for aptness 2016-05-24 17:52:16 +02:00
Benno Schulenberg 1b902d6267 tweaks: elide unneeded intermediate assignments 2016-05-24 17:52:01 +02:00
Benno Schulenberg 619044e83d tweaks: put some conditions in a better order: the main one first 2016-05-24 17:51:50 +02:00
Benno Schulenberg e0e788e218 tweaks: reshuffle a few things 2016-05-23 21:34:02 +02:00
Benno Schulenberg a617d9c05e tweaks: remove a redundant assignment 2016-05-23 21:25:00 +02:00
Benno Schulenberg 99e6293cd0 tweaks: remove an unnecessary intermediate assignment 2016-05-23 20:57:08 +02:00
Benno Schulenberg 286b6a9088 tweaks: rename a variable, to indicate better what it contains
And to contrast it more with 'answer'.
2016-05-23 20:46:58 +02:00
Benno Schulenberg 27e07d2af5 tweaks: rename two variables, to avoid using a name for different purposes
When calling do_prompt(), 'ans' is used to offer a default answer or the
answer given so far.
2016-05-23 20:30:01 +02:00
Benno Schulenberg 1228b2c05b tweaks: rename a variable, to indicate what it contains 2016-05-23 20:29:52 +02:00
Benno Schulenberg d6a04b8a62 tweaks: improve a few comments 2016-05-23 20:29:31 +02:00
Benno Schulenberg fbb6208d15 browser, files: use full path in error message when in confined mode
The relative path could be . or .. or even empty, which is uninformative.

This fixes the last part of https://savannah.gnu.org/bugs/?47798.
2016-05-22 11:41:58 +02:00
Benno Schulenberg c0285682e4 startup: show an error message when argument of --operatingdir is invalid
Move the initialization of the operating directory to after the
initialization of the screen, so that the above error can be shown.

This fixes the first part of https://savannah.gnu.org/bugs/?47798.
2016-05-22 11:41:58 +02:00
Benno Schulenberg 60da39cdf7 files: fix a memory leak 2016-05-21 21:35:12 +02:00
Benno Schulenberg 2e75c22759 browser: fix a memory leak 2016-05-21 21:35:02 +02:00
Benno Schulenberg 9576eb62e6 browser: show a message when getcwd() fails, instead of just beeping 2016-05-21 21:34:25 +02:00
Benno Schulenberg f9fe9a7d57 backups: take an unlikely condition into account
Between the first stat (that sets 'realexists') and the second stat
(directly after), the file might have disappeared, which would mean
that current_stat would be NULL.  Prevent dereferencing this further
down.
2016-05-21 13:58:41 +02:00
Benno Schulenberg 8bf5e58f37 tweaks: improve a few comments 2016-05-21 13:58:41 +02:00
Benno Schulenberg f6fdeeb3af files: remove a redundant condition 2016-05-21 13:58:41 +02:00
Benno Schulenberg e65352bc8a files: when writing a lockfile fails, continue loading the file
Only when the user decides not to override an existing lockfile should
loading the corresponding file be skipped.  Any failure to write the
lockfile should be ignored -- the file itself should be loaded anyway.

This fixes https://savannah.gnu.org/bugs/?47945.
2016-05-21 13:58:41 +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 c9d1936f02 files: don't reuse a variable that may have been modified by dirname()
The variable 'namecopy' has been passed to dirname(), so it is likely
to have been changed when it contains a slash.  So, use a new variable
instead.  Also, free the result of display_string().

This fixes https://savannah.gnu.org/bugs/?47956.
2016-05-18 21:34:16 +02:00
Benno Schulenberg faf5227bc5 files: remove a superfluous condition, and do not ignore a "No"
Having just opened a fresh buffer, 'openfile->next' will never be NULL,
because the list is circular.

Second, when compiled with --disable-nultibuffer, and deciding not to
override an existing lock, the 'return FALSE' should *not* be skipped,
because otherwise the named file will be opened after all.

This fixes an unreported bug.
2016-05-18 17:59:22 +02:00
Benno Schulenberg bc33539b11 files: upgrade the locking errors, so they will not be overwritten
Make the failures to read or write a lock file into important messages,
so they will not be overwritten by the number of lines read.
2016-05-18 12:08:54 +02:00
Benno Schulenberg 906ada8fe7 files: remove the special 'quiet' mechanism for not overwriting messages
The general mechanism for not allowing important messages to be overwritten
will take care of not overwriting warnings about failed file lockings.
2016-05-18 12:04:45 +02:00
Benno Schulenberg a878f5f183 screen: catch a window resize also when the keyboard is in nodelay mode
This fixes https://savannah.gnu.org/bugs/?47954.
2016-05-18 11:14:17 +02:00
Benno Schulenberg 5cbaf5903b tweaks: rearrange some key reading stuff in a clearer way 2016-05-18 10:36:37 +02:00
Benno Schulenberg f7c3e1cac2 spelling: gettextize the next-word message 2016-05-18 10:25:16 +02:00
Benno Schulenberg d7d3a87624 tweaks: elide an unneeded variable 2016-05-17 21:29:44 +02:00
Benno Schulenberg c03ce956c8 browser: after getting a mouse click, don't try any further interpretation
Either the selected file was changed, or a file or directory was chosen
(and the Enter key virtually pressed), or a shortcut was executed.  So,
just go and read the next key.

This fixes https://savannah.gnu.org/bugs/?47944.
2016-05-17 17:49:15 +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 58404e4ba2 browser: keep the highlight in the same spot or column, when possible
When doing a PageUp or PageDown in the browser, don't move the highlight
to the first line in the same column, but keep it in the same relative
position of the screen.  If we're already on the first or last page,
move the highlight to the first or last line, but keep it in the same
column.  If we're already on the first or last line, only then move it
to the first or last entry.
2016-05-16 17:03:45 +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 04a230f933 tweaks: avoid a warning when configured with --disable-wrapping 2016-05-16 16:36:49 +02:00