Benno Schulenberg
eac90c3eff
prompt: blank the bar when a "continue?" is answered with No or ^C
...
This fixes https://savannah.gnu.org/bugs/?52755 .
Reported-by: Brand Huntsman <alpha@qzx.com>
2017-12-29 17:01:15 +01:00
Benno Schulenberg
dc3618a127
text: set and reset the Modified state correctly when undoing/redoing
...
Unset the "Modified" marker only at the point where the file was last
saved -- if there is such a point, because it can be missing when the
undo stack was discarded.
This fixes https://savannah.gnu.org/bugs/?52689 .
Reported-by: Liu Hao <lh_mouse@126.com>
Original-idea-by: Brand Huntsman <alpha@qzx.com>
2017-12-19 19:22:52 +01:00
Benno Schulenberg
31fe0753e3
tweaks: limit the resetting of "Modified" to writing a full buffer
...
When doing that, there is no need to save and restore the Modified
state when writing a marked region.
2017-12-19 17:57:49 +01:00
Benno Schulenberg
0c40f87b55
tweaks: invert the logic of a variable, and rename it
...
To get rid of two double negatives.
2017-12-03 20:49:01 +01:00
Benno Schulenberg
20aa167c14
files: always update the stat info when the entire file is written
...
This fixes https://savannah.gnu.org/bugs/?52519 .
2017-11-26 20:57:30 +01:00
Benno Schulenberg
0c9905dbd0
undo: clear the Modified state when the very first edit is undone
...
This also means that no question needs to be asked when exiting.
This fixes https://savannah.gnu.org/bugs/?52504 .
Reported-by: Peter Passchier <peter@passchier.net>
2017-11-26 19:55:44 +01:00
Benno Schulenberg
cf63a2910a
files: save the marked region only when we've prompted for a file name
...
Otherwise we would overwrite the current file with just the selection.
This fixes https://savannah.gnu.org/bugs/?52482 .
2017-11-22 20:56:37 +01:00
Benno Schulenberg
7c3c942097
tweaks: adjust indentation after previous change
2017-11-22 19:43:50 +01:00
Benno Schulenberg
77d24300f3
tweaks: reshuffle a couple of lines, and frob a comment or two
2017-11-22 19:36:33 +01:00
Benno Schulenberg
c24e95e3d6
tweaks: elide the 'mark_set' boolean -- the 'mark' pointer is enough
...
The pointer not being NULL is enough indication that the mark is set.
Also, rename the pointer from 'mark_begin' to simply 'mark', since
the former is kind of pleonastic.
2017-11-21 21:14:33 +01:00
Benno Schulenberg
8165b20fc1
build: fix compilation with --disable-browser --disable-tabcomp
...
While doing that, move the affected function to the utils.c file
and tweak it a bit.
This fixes https://savannah.gnu.org/bugs/?52468 .
2017-11-20 19:37:08 +01:00
Benno Schulenberg
f6e83438da
tweaks: elide a comment, and improve a couple of others
2017-11-13 19:58:29 +01:00
David Lawrence Ramsey
169da09424
files: don't change file format when inserting into an existing buffer
...
This fixes https://savannah.gnu.org/bugs/?52392 .
2017-11-13 19:42:44 +01:00
Benno Schulenberg
5198c1f139
tweaks: frob a couple of comments
2017-11-12 20:08:28 +01:00
Benno Schulenberg
5239e7c52b
copyright: update some years, and standardize on the dashed format
2017-11-12 10:46:20 +01:00
Benno Schulenberg
a7f5907b43
tweaks: move a general function to the utils.c file
2017-11-11 11:34:39 +01:00
David Lawrence Ramsey
477b246771
tweaks: use printf's z modifier for most of the size_t/ssize_t types
...
Also, properly refer to numreplaced as signed, since it's ssize_t
(even though it's only shown when positive).
2017-11-07 17:55:21 +01:00
Benno Schulenberg
d054044d30
tweaks: transform the token DISABLE_EXTRA to ENABLE_EXTRA
2017-11-01 20:33:14 +01:00
Benno Schulenberg
d5ac1ed395
tweaks: transform the token DISABLE_COLOR to ENABLE_COLOR
2017-11-01 19:45:50 +01:00
Benno Schulenberg
2a4fc9591f
tweaks: transform the token DISABLE_SPELLER to ENABLE_SPELLER
2017-10-31 19:32:42 +01:00
Benno Schulenberg
028d12f4fb
tweaks: transform the token DISABLE_OPERATINGDIR to ENABLE_OPERATINGDIR
2017-10-29 21:08:07 +01:00
Benno Schulenberg
ff35a61355
tweaks: transform the token DISABLE_HISTORIES to ENABLE_HISTORIES
2017-10-29 19:43:05 +01:00
Benno Schulenberg
3f27c312c4
tweaks: get rid of some cluttering conditional compilation
...
In the tiny version, do_prompt() will now have an extra NULL
parameter, which will cost maybe twenty extra bytes of code.
That is acceptable when it saves thirty lines in the source.
2017-10-29 11:39:27 +01:00
Benno Schulenberg
ab6e4e36e2
tweaks: fix compilation with --enable-tiny --enable-histories
2017-10-29 10:49:08 +01:00
Benno Schulenberg
84c650b80a
files: avoid an abortion when excuting a command in a new buffer
...
The key sequence ^R ^X M-F <Enter> would cause nano to abort, because
it would try to add an empty string to a history list. (Furthermore,
simply don't execute an empty command, because it is pointless.)
Reported-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
2017-10-28 12:33:03 +02:00
Benno Schulenberg
ba65cd48cc
bindings: make ^Q and ^S do something useful by default
...
^S will be the first thing people will try for saving a file,
and ^Q is somewhat mnemonic because it is to the left of ^W:
it searches backward.
Make these keystrokes available also in the tiny version.
2017-10-14 20:34:43 +02:00
Benno Schulenberg
a7fa174438
tweaks: adjust indentation and comments after the previous change
2017-10-14 11:58:28 +02:00
Viorel Bota
217cfbf362
files: check for a changed disk file also for 'savefile' and --tempfile
...
Before writing a file out, nano should check that the file on disk
hasn't been modified since it was read -- not only for the normal
"Write Out" action (^O), but also for "Save File" (future ^S) and
for "Save and Exit" (^X when --tempfile is used).
When writing fails and --tempfile is in effect, don't go on to prompt
for a file name; instead let the user decide what she wants to do.
This fixes https://savannah.gnu.org/bugs/?51040 .
Signed-off-by: Viorel Bota <botaviorel@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2017-10-13 20:24:10 +02:00
Benno Schulenberg
a2b4f00a27
tweaks: fix compilation when configured with --disable-histories
2017-10-03 21:39:09 +02:00
Benno Schulenberg
7c3c3cbb3b
tweaks: discard some obsolete debugging stuff
2017-09-22 21:59:51 +02:00
Benno Schulenberg
2d13afda40
display: stop the help viewer from turning on the multibuffer indicator
...
This fixes https://savannah.gnu.org/bugs/?52060 .
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
2017-09-19 20:42:47 +02:00
Benno Schulenberg
a1c73317f7
organization: move all history-related stuff to its own file
2017-09-17 12:46:36 +02:00
Marco Diego Aurélio Mesquita
a75bf0a1d1
history: remember the list of executed commands across sessions
...
Signed-off-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
2017-09-17 12:46:09 +02:00
Marco Diego Aurélio Mesquita
c8363a0d0b
history: remember the commands that were executed during this session
...
Signed-off-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
2017-09-14 20:10:22 +02:00
Benno Schulenberg
cbf4f77d6b
titlebar: don't reshow version when dropping back to a single buffer
...
When multiple files were open and [x/n] was being shown in the title
bar, don't show nano's name and version number when just one buffer
remains open, but show [1/1] instead. It is less surprising.
2017-09-13 19:29:56 +02:00
Marco Diego Aurélio Mesquita
3fc89e0853
new feature: show current and total number of open buffers in title bar
...
When multiple buffers are open, replace nano's name and version number
with an indication how many buffers are open preceded by the sequence
number of the current buffer.
Signed-off-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2017-09-13 19:29:38 +02:00
Benno Schulenberg
21ffa883f7
tweaks: use mnemonic constants instead of TRUE and FALSE
...
And use these constants in another context too.
2017-08-31 22:14:06 +02:00
Benno Schulenberg
98ec41b4fa
tweaks: rename three functions, to be shorter or clearer
2017-08-31 22:00:53 +02:00
Benno Schulenberg
4bbbb1859b
tweaks: adjust the indentation after the previous change
...
Also rename a variable, to match the saving routine.
2017-08-16 21:46:39 +02:00
Benno Schulenberg
6645351bfc
tweaks: avoid trying to stat a file that might be NULL [coverity scan]
2017-08-16 21:39:41 +02:00
Benno Schulenberg
a5981ab043
tweaks: don't close a descriptor when its stream has already been closed
2017-08-16 20:31:38 +02:00
Benno Schulenberg
8b86af3fef
tweaks: adjust the indentation after the previous change
2017-08-15 19:13:22 +02:00
Benno Schulenberg
21a5978027
tweaks: reshuffle some code to harmonize two related functions
2017-08-15 18:05:06 +02:00
Benno Schulenberg
b4fd08fa5e
tweaks: keep the const qualifier of the syntax name [coverity scan]
...
Also, reduce the scope of the 'line' variable.
2017-08-15 17:20:07 +02:00
Benno Schulenberg
252dc138a2
tweaks: reshuffle some declarations and trim a few comments
2017-08-15 14:15:23 +02:00
Benno Schulenberg
de57d8b722
files: don't try to open a negative file descriptor [coverity scan]
2017-08-15 13:48:25 +02:00
Benno Schulenberg
dbbe267d71
files: don't close a file descriptor when opening failed [coverity scan]
...
Also, don't depend on statting the relative path, because if that would
fail, we would try to open a NULL pointer.
2017-08-15 13:06:31 +02:00
Benno Schulenberg
eed0090e32
tweaks: close a file also in the error path [coverity scan]
2017-08-15 12:24:18 +02:00
Benno Schulenberg
3ab943c49a
tweaks: condense some logic, to elide a variable and a comment
2017-08-13 10:09:02 +02:00
Benno Schulenberg
ec20e3a7a8
tweaks: rename a function, to let it make more sense
...
Further, slightly reword an error message so it is appropriate also
when an out-of-bounds file is specified on the command line.
2017-08-13 10:08:50 +02:00