Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b4e433687 | ||
|
|
22c83ec7af | ||
|
|
2072b74153 | ||
|
|
66e5972c52 | ||
|
|
a149549d07 | ||
|
|
67acf2c753 | ||
|
|
29479ca7f5 | ||
|
|
b7a2dfb2da | ||
|
|
f4e26d174e | ||
|
|
2e4228f78e | ||
|
|
a016f00f14 | ||
|
|
76d61ec167 | ||
|
|
2a76b434fc | ||
|
|
1642e6a368 | ||
|
|
3116d2f7de | ||
|
|
4cc2462ed4 | ||
|
|
170607b6c9 | ||
|
|
636e76af23 | ||
|
|
220247172a | ||
|
|
d70c7f3c14 | ||
|
|
21f73f902f | ||
|
|
bf88d27adc | ||
|
|
2ad1de0ba6 | ||
|
|
d84849ec12 |
55
ChangeLog
55
ChangeLog
@@ -1,3 +1,58 @@
|
||||
2013-03-17 Chris Allegretta <chrisa@asty.org>
|
||||
* Revert r4547 as we should have a new release and the overlap code is not yet
|
||||
ready for public consumption.
|
||||
|
||||
2013-01-20 Chris Allegretta <chrisa@asty.org>
|
||||
* src/text.c (do_histify): Don't allow sigwinch to be received while justifying
|
||||
as that puts us into a wacky state. Fixess crash on justify by Joshua Rogers.
|
||||
* configure.ac: Added --with-wordbounds option to let cross compilers force
|
||||
whether their target system support GNU-style word boundaries or not.
|
||||
Originally reported by dave festing.
|
||||
* doc/man/nanorc.5: Fix typo in softwrap description, reported by
|
||||
cbart387@Savannah.
|
||||
|
||||
2013-01-19 Chris Allegretta <chrisa@asty.org>
|
||||
* configure.ac: Make ncurses checking to set $LIBS and check the ncursesw lib
|
||||
actually works before defaulting to it over ncurses! Shock!
|
||||
|
||||
2013-01-13 Chris Allegretta <chrisa@asty.org>
|
||||
* src/utils.c (parse_num): Initalize errno before calling strtol(). Fixes issue
|
||||
where trying to go to a line number too long will break legitimate goto-lines
|
||||
for the remainder of the editing session, reported by Joshua Rogers.
|
||||
|
||||
2013-01-09 Mike Frysinger <vapier@gentoo.org>
|
||||
* configure.ac: Check for ncursesw5-config and base $CPPFLAGS based on it.
|
||||
|
||||
2013-01-09 Fabian Groffen <grobian@Savannah>
|
||||
* configure.ac, src/nano.h: Make search for ncursesw more generalized.
|
||||
|
||||
2013-01-02 David Benjamin <davidben@Savannah>
|
||||
* src/search.c (parse_syntax): Fix blatantly and dangerously incorrect code for
|
||||
deleting old syntaxes.
|
||||
|
||||
2013-01-02 Mike Frysinger <vapier@gentoo.org>
|
||||
* src/files.c (cwd_tab_completion): Remove unnecessary variables
|
||||
* src/search.c (search_init): Fix gcc complaints on certain versions
|
||||
|
||||
2013-01-02 Eitan Adler <lists@eitanadler.com>
|
||||
* configure.ac: Remove unnecessary checks
|
||||
* src/nano.h, NEWS: Fix redundant wording
|
||||
|
||||
2012-12-31 Chris Allegretta <chrisa@asty.org>
|
||||
* src/*: Introduce (basic) vim-style file locks. Does not allow vim to recover
|
||||
our changes, and just lets a vim user know we're editing a file. Commands line "-G"
|
||||
or "--locking", nanorc option "locking". New functions
|
||||
src/files.c:do_lockfile(), write_lockfile(), and delete_lockfile().
|
||||
|
||||
2012-02-05 Chris Allegretta <chrisa@asty.org>
|
||||
* src/*: Fix overlapping strings highlighting each other. new variables in edit_draw
|
||||
(slmatcharray, pbegin, paintok), new logic (with repeated setting od values in the
|
||||
array but its BFI after all). FIXME: Need to create a new 'overlap'
|
||||
* src/*: Fix a silly issue with the argument to nregcomp, as it's confusing to the caller
|
||||
* src/nano.h: Change the color types to a compiler macro (COLORWIDTH), may not actually
|
||||
even be worth doing, but someday who knows how wide a color curses implementation might
|
||||
be, and maybe we'll even start checking for it in autoconf!
|
||||
|
||||
GNU nano 2.3.1 - 2011.05.10
|
||||
2011-05-10 Chris Allegretta <chrisa@asty.org>
|
||||
* text.c (do_enter): Only increment totsize by the auto-indented amount, size the previous line's size was
|
||||
|
||||
16
NEWS
16
NEWS
@@ -1,3 +1,13 @@
|
||||
2013.03.22 - GNU nano 2.3.2 "Annoy your coworkers for fun and profit" is
|
||||
released. This release introduces vim-style file locking
|
||||
(though not backup/restore), useful when using nano
|
||||
in a multi-editor environment. Feedback is welcome if
|
||||
you run into any issues with this new code. Other new
|
||||
features include additional support for word boundary
|
||||
checking when cross compiling, fixes for trying to go to
|
||||
an invalid line number, and the usual documentation
|
||||
tweaks.
|
||||
|
||||
2011.05.10 - GNU nano 2.3.1 "I'm in space" is released. This
|
||||
release includes some fixes for the new libmagic code, as
|
||||
well as a fix for improper character counts when using
|
||||
@@ -745,10 +755,10 @@
|
||||
new option to ignore rc files (-I,--ignorercfiles),
|
||||
compatibility with -pedantic, handling null characters
|
||||
before EOF, a slightly sportier nanorc.sample and more.
|
||||
Fixes are included included for justification,
|
||||
Fixes are included for justification,
|
||||
the reading and writing file routines, resizing and fill
|
||||
length, millions of memory leaks, the usage screen was
|
||||
updated, and the the --quotestr and --regexp really work
|
||||
updated, and the --quotestr and --regexp really work
|
||||
now ;-) Enjoy :)
|
||||
|
||||
05/12/2002 - GNU nano 1.1.9 is released, happy Mother's Day! This
|
||||
@@ -1073,7 +1083,7 @@
|
||||
|
||||
08/03/2000 - Nano 0.9.15 is the "I can't think of a release description"
|
||||
release. There are the usual gala of display bugfixes,
|
||||
a fix for the the nasty bug in -k mode that could create
|
||||
a fix for the nasty bug in -k mode that could create
|
||||
a loop in the file being edited, and some other code
|
||||
cleanup. Also, the -T option should now work regardless
|
||||
of the curses library used. Yay.
|
||||
|
||||
46
configure.ac
46
configure.ac
@@ -20,9 +20,9 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU nano], [2.3.1], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [2.3.2], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_TARGET([])
|
||||
AC_CANONICAL_HOST
|
||||
AM_INIT_AUTOMAKE
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
@@ -49,7 +49,6 @@ AC_DEFINE_DIR([PKGDATADIR], [pkgdatadir], [Where data are placed to.])
|
||||
|
||||
dnl Checks for header files.
|
||||
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(getopt.h libintl.h limits.h regex.h sys/param.h wchar.h wctype.h stdarg.h magic.h)
|
||||
|
||||
dnl Checks for options.
|
||||
@@ -442,7 +441,17 @@ if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
AC_CHECK_HEADERS(ncurses.h)
|
||||
|
||||
if test x$enable_utf8 != xno; then
|
||||
AC_CHECK_LIB(ncursesw, get_wch, [CURSES_LIB="-lncursesw" CPPFLAGS="-I/usr/include/ncursesw $CPPFLAGS" CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
|
||||
OLDLIBS="$LIBS"
|
||||
AC_CHECK_TOOL(NCURSESW_CONFIG, ncursesw5-config, no)
|
||||
if test "x$NCURSESW_CONFIG" != xno; then
|
||||
CURSES_LIB=`$NCURSESW_CONFIG --libs`
|
||||
LIBS="$CURSES_LIB $LIBS"
|
||||
CPPFLAGS="`$NCURSESW_CONFIG --cflags` $CPPFLAGS"
|
||||
AC_CHECK_LIB(ncursesw, get_wch, [CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
|
||||
else
|
||||
AC_CHECK_LIB(ncursesw, get_wch, [CURSES_LIB="-lncursesw" CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
|
||||
fi
|
||||
LIBS="$OLDLIBS"
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
@@ -519,7 +528,22 @@ fi
|
||||
if test x$color_support = xyes; then
|
||||
# now check for the end of word boundary support (/< and />)
|
||||
AC_MSG_CHECKING([for GNU-style word boundary regex support])
|
||||
AC_TRY_RUN([
|
||||
|
||||
AC_ARG_WITH(wordbounds,
|
||||
[ --with-wordbounds Use GNU-style word boundary delimiters],
|
||||
[ case "$with_wordbounds" in
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(yes)
|
||||
# We explicitly don't check if the user forced the option, because
|
||||
# this is needed for cross compilers and we cant test the target
|
||||
AC_DEFINE(GNU_WORDBOUNDS, 1, [Define if the system supports GNU-style word boundaries in regexes.]) gnu_wordbounds=yes,
|
||||
;;
|
||||
esac
|
||||
], [
|
||||
AC_TRY_RUN([
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
@@ -536,11 +560,13 @@ int main(void)
|
||||
return 1;
|
||||
return 0;
|
||||
}],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(GNU_WORDBOUNDS, 1, [Define if the system supports GNU-style word boundaries in regexes.]) gnu_wordbounds=yes,
|
||||
AC_MSG_RESULT(no),
|
||||
AC_MSG_WARN([*** Can't check for GNU-style word boundary support when cross-compiling])
|
||||
)
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(GNU_WORDBOUNDS, 1, [Define if the system supports GNU-style word boundaries in regexes.]) gnu_wordbounds=yes,
|
||||
AC_MSG_RESULT(no),
|
||||
AC_MSG_WARN([*** Can't check for GNU-style word boundary support when cross-compiling])
|
||||
)
|
||||
])
|
||||
|
||||
# if test x$CURSES_LIB_NAME = xcurses; then
|
||||
AC_MSG_CHECKING([whether _XOPEN_SOURCE_EXTENDED is needed])
|
||||
AC_TRY_RUN([
|
||||
|
||||
@@ -77,6 +77,9 @@ Convert typed tabs to spaces.
|
||||
.B \-F (\-\-multibuffer)
|
||||
Enable multiple file buffers, if available.
|
||||
.TP
|
||||
.B \-G (\-\-locking)
|
||||
Enable vim-style file locking when editing files.
|
||||
.TP
|
||||
.B \-H (\-\-historylog)
|
||||
Log search and replace strings to \fI~/.nano_history\fP, so they can be
|
||||
retrieved in later sessions, if \fInanorc\fP support is available.
|
||||
|
||||
@@ -102,6 +102,9 @@ default value is \-8.
|
||||
Enable \fI~/.nano_history\fP for saving and reading search/replace
|
||||
strings.
|
||||
.TP
|
||||
.B set/unset locking
|
||||
Enable vim-style lock-files for when editing files.
|
||||
.TP
|
||||
.B set matchbrackets "\fIstring\fP"
|
||||
Set the opening and closing brackets that can be found by bracket
|
||||
searches. They cannot contain blank characters. The former set must
|
||||
@@ -194,7 +197,7 @@ line.
|
||||
Use smooth scrolling by default.
|
||||
.TP
|
||||
.B set/unset softwrap
|
||||
Enable soft line wrapping for easier viewing of very long lones.
|
||||
Enable soft line wrapping for easier viewing of very long lines.
|
||||
.TP
|
||||
.B set speller "\fIspellprog\fP"
|
||||
Use spelling checker \fIspellprog\fP instead of the built-in one, which
|
||||
|
||||
@@ -56,6 +56,11 @@
|
||||
## Enable ~/.nano_history for saving and reading search/replace strings.
|
||||
# set historylog
|
||||
|
||||
## Enable vim-style lock-files. This is just to let a vim user know you
|
||||
## are editing a file [s]he is trying to edit and vice versa. There are
|
||||
## no plans to implement vim-style undo state in these files
|
||||
# set locking
|
||||
|
||||
## The opening and closing brackets that can be found by bracket
|
||||
## searches. They cannot contain blank characters. The former set must
|
||||
## come before the latter set, and both must be in the same order.
|
||||
|
||||
@@ -4,7 +4,7 @@ syntax "nanorc" "\.?nanorc$"
|
||||
## Possible errors and parameters
|
||||
icolor brightwhite "^[[:space:]]*((un)?set|include|syntax|i?color).*$"
|
||||
## Keywords
|
||||
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backupdir|backwards|boldtext|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|poslog|preserve|punct)\>" "^[[:space:]]*(set|unset)[[:space:]]+(quickblank|quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|speller|suspend|suspendenable|tabsize|tabstospaces|tempfile|undo|view|whitespace|wordbounds)\>"
|
||||
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backupdir|backwards|boldtext|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|poslog|preserve|punct)\>" "^[[:space:]]*(set|unset)[[:space:]]+(quickblank|quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|speller|suspend|suspendenable|tabsize|tabstospaces|tempfile|undo|view|whitespace|wordbounds|locking)\>"
|
||||
icolor green "^[[:space:]]*(set|unset|include|syntax|header|magic)\>"
|
||||
## Colors
|
||||
icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# List of available languages.
|
||||
bg ca cs da de eo es eu fi fr ga gl hu id it ms nb nl nn pl pt_BR ro ru rw sr sv tr uk vi zh_CN zh_TW
|
||||
bg ca cs da de eo es eu fi fr ga gl hu id it ja ms nb nl nn pl pt_BR ro ru rw sl sr sv tr uk vi zh_CN zh_TW
|
||||
|
||||
791
po/nano.pot
791
po/nano.pot
File diff suppressed because it is too large
Load Diff
791
po/pt_BR.po
791
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
792
po/zh_CN.po
792
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
824
po/zh_TW.po
824
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -794,7 +794,7 @@ int filesearch_init(void)
|
||||
TRUE,
|
||||
#endif
|
||||
MWHEREISFILE, backupstring,
|
||||
&meta_key, &func_key,
|
||||
&meta_key, &func_key,
|
||||
#ifndef NANO_TINY
|
||||
&search_history,
|
||||
#endif
|
||||
|
||||
@@ -79,12 +79,12 @@ bool is_byte(int c)
|
||||
return ((unsigned int)c == (unsigned char)c);
|
||||
}
|
||||
|
||||
static void mbtowc_reset(void)
|
||||
void mbtowc_reset(void)
|
||||
{
|
||||
IGNORE_CALL_RESULT(mbtowc(NULL, NULL, 0));
|
||||
}
|
||||
|
||||
static void wctomb_reset(void)
|
||||
void wctomb_reset(void)
|
||||
{
|
||||
IGNORE_CALL_RESULT(wctomb(NULL, 0));
|
||||
}
|
||||
|
||||
233
src/files.c
233
src/files.c
@@ -31,6 +31,7 @@
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <pwd.h>
|
||||
#include <libgen.h>
|
||||
|
||||
/* Add an entry to the openfile openfilestruct. This should only be
|
||||
* called from open_buffer(). */
|
||||
@@ -77,6 +78,7 @@ void initialize_buffer(void)
|
||||
openfile->current_stat = NULL;
|
||||
openfile->undotop = NULL;
|
||||
openfile->current_undo = NULL;
|
||||
openfile->lock_filename = NULL;
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
openfile->colorstrings = NULL;
|
||||
@@ -103,6 +105,207 @@ void initialize_buffer_text(void)
|
||||
openfile->totsize = 0;
|
||||
}
|
||||
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Actyally write the lock file. This function will
|
||||
ALWAYS annihilate any previous version of the file.
|
||||
We'll borrow INSECURE_BACKUP here to decide about lock file
|
||||
paranoia here as well...
|
||||
Args:
|
||||
lockfilename: file name for lock
|
||||
origfilename: name of the file the lock is for
|
||||
modified: whether to set the modified bit in the file
|
||||
|
||||
Returns: 1 on success, 0 on failure (but continue loading), -1 on failure and abort
|
||||
*/
|
||||
int write_lockfile(const char *lockfilename, const char *origfilename, bool modified)
|
||||
{
|
||||
int cflags, fd;
|
||||
FILE *filestream;
|
||||
pid_t mypid;
|
||||
uid_t myuid;
|
||||
struct passwd *mypwuid;
|
||||
char *lockdata = charalloc(1024);
|
||||
char myhostname[32];
|
||||
ssize_t lockdatalen = 1024;
|
||||
ssize_t wroteamt;
|
||||
|
||||
/* Run things which might fail first before we try and blow away
|
||||
the old state */
|
||||
myuid = geteuid();
|
||||
if ((mypwuid = getpwuid(myuid)) == NULL) {
|
||||
statusbar(_("Couldn't determine my identity for lock file (getpwuid() failed)"));
|
||||
return -1;
|
||||
}
|
||||
mypid = getpid();
|
||||
|
||||
if (gethostname(myhostname, 31) < 0) {
|
||||
statusbar(_("Couldn't determine hosttname for lock file: %s"), strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (delete_lockfile(lockfilename) < 0)
|
||||
return -1;
|
||||
|
||||
if (ISSET(INSECURE_BACKUP))
|
||||
cflags = O_WRONLY | O_CREAT | O_APPEND;
|
||||
else
|
||||
cflags = O_WRONLY | O_CREAT | O_EXCL | O_APPEND;
|
||||
|
||||
fd = open(lockfilename, cflags,
|
||||
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
|
||||
|
||||
/* Maybe we just don't have write access, don't stop us from
|
||||
opening the file at all, just don't set the lock_filename
|
||||
and return success */
|
||||
if (fd < 0 && errno == EACCES)
|
||||
return 1;
|
||||
|
||||
/* Now we've got a safe file stream. If the previous open()
|
||||
call failed, this will return NULL. */
|
||||
filestream = fdopen(fd, "wb");
|
||||
|
||||
if (fd < 0 || filestream == NULL) {
|
||||
statusbar(_("Error writing lock file %s: %s"), lockfilename,
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* Okay. so at the moment we're following this state for how
|
||||
to store the lock data:
|
||||
byte 0 - 0x62
|
||||
byte 1 - 0x30
|
||||
bytes 2-12 - program name which created the lock
|
||||
bytes 24,25 - little endian store of creator program's PID
|
||||
(b24 = 256^0 column, b25 = 256^1 column)
|
||||
bytes 28-44 - username of who created the lock
|
||||
bytes 68-100 - hostname of where the lock was created
|
||||
bytes 108-876 - filename the lock is for
|
||||
byte 1007 - 0x55 if file is modified
|
||||
|
||||
Looks like VIM also stores undo state in this file so we're
|
||||
gonna have to figure out how to slap a 'OMG don't use recover
|
||||
on our lockfile' message in here...
|
||||
|
||||
This is likely very wrong, so this is a WIP
|
||||
*/
|
||||
null_at(&lockdata, lockdatalen);
|
||||
lockdata[0] = 0x62;
|
||||
lockdata[1] = 0x30;
|
||||
lockdata[24] = mypid % 256;
|
||||
lockdata[25] = mypid / 256;
|
||||
snprintf(&lockdata[2], 10, "nano %s", VERSION);
|
||||
strncpy(&lockdata[28], mypwuid->pw_name, 16);
|
||||
strncpy(&lockdata[68], myhostname, 31);
|
||||
strncpy(&lockdata[108], origfilename, 768);
|
||||
if (modified == TRUE)
|
||||
lockdata[1007] = 0x55;
|
||||
|
||||
wroteamt = fwrite(lockdata, sizeof(char), lockdatalen, filestream);
|
||||
if (wroteamt < lockdatalen) {
|
||||
statusbar(_("Error writing lock file %s: %s"),
|
||||
lockfilename, ferror(filestream));
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "In write_lockfile(), write successful (wrote %d bytes)\n", wroteamt);
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (fclose(filestream) == EOF) {
|
||||
statusbar(_("Error writing lock file %s: %s"),
|
||||
lockfilename, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
openfile->lock_filename = lockfilename;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Less exciting, delete the lock file.
|
||||
Return -1 if successful and complain on the statusbar, 1 otherwite
|
||||
*/
|
||||
int delete_lockfile(const char *lockfilename)
|
||||
{
|
||||
if (unlink(lockfilename) < 0 && errno != ENOENT) {
|
||||
statusbar(_("Error deleting lock file %s: %s"), lockfilename,
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/* Deal with lockfiles. Return -1 on refusing to override
|
||||
the lock file, and 1 on successfully created the lockfile, 0 means
|
||||
we were not successful on creating the lockfile but we should
|
||||
continue to load the file and complain to the user.
|
||||
*/
|
||||
int do_lockfile(const char *filename)
|
||||
{
|
||||
char *lockdir = dirname((char *) mallocstrcpy(NULL, filename));
|
||||
char *lockbase = basename((char *) mallocstrcpy(NULL, filename));
|
||||
ssize_t lockfilesize = (sizeof (char *) * (strlen(filename)
|
||||
+ strlen(locking_prefix) + strlen(locking_suffix) + 3));
|
||||
char *lockfilename = (char *) nmalloc(lockfilesize);
|
||||
char lockprog[12], lockuser[16];
|
||||
struct stat fileinfo;
|
||||
int lockfd, lockpid;
|
||||
|
||||
|
||||
snprintf(lockfilename, lockfilesize, "%s/%s%s%s", lockdir,
|
||||
locking_prefix, lockbase, locking_suffix);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "lock file name is %s\n", lockfilename);
|
||||
#endif /* DEBUG */
|
||||
if (stat(lockfilename, &fileinfo) != -1) {
|
||||
ssize_t readtot = 0;
|
||||
ssize_t readamt = 0;
|
||||
char *lockbuf = (char *) nmalloc(8192);
|
||||
char *promptstr = (char *) nmalloc(128);
|
||||
int ans;
|
||||
if ((lockfd = open(lockfilename, O_RDONLY)) < 0) {
|
||||
statusbar(_("Error opening lockfile %s: %s"),
|
||||
lockfilename, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
do {
|
||||
readamt = read(lockfd, &lockbuf[readtot], BUFSIZ);
|
||||
readtot += readamt;
|
||||
} while (readtot < 8192 && readamt > 0);
|
||||
|
||||
if (readtot < 48) {
|
||||
statusbar(_("Error reading lockfile %s: Not enough data read"),
|
||||
lockfilename);
|
||||
return -1;
|
||||
}
|
||||
strncpy(lockprog, &lockbuf[2], 10);
|
||||
lockpid = lockbuf[25] * 256 + lockbuf[24];
|
||||
strncpy(lockuser, &lockbuf[28], 16);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "lockpid = %d\n", lockpid);
|
||||
fprintf(stderr, "program name which created this lock file should be %s\n",
|
||||
lockprog);
|
||||
fprintf(stderr, "user which created this lock file should be %s\n",
|
||||
lockuser);
|
||||
#endif /* DEBUG */
|
||||
sprintf(promptstr, "File being edited (by %s, PID %d, user %s), continue?",
|
||||
lockprog, lockpid, lockuser);
|
||||
ans = do_yesno_prompt(FALSE, promptstr);
|
||||
if (ans < 1) {
|
||||
blank_statusbar();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return write_lockfile(lockfilename, filename, FALSE);
|
||||
}
|
||||
#endif /* NANO_TINY */
|
||||
|
||||
|
||||
/* If it's not "", filename is a file to open. We make a new buffer, if
|
||||
* necessary, and then open and read the file, if applicable. */
|
||||
void open_buffer(const char *filename, bool undoable)
|
||||
@@ -128,16 +331,16 @@ void open_buffer(const char *filename, bool undoable)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If the filename isn't blank, open the file. Otherwise, treat it
|
||||
* as a new file. */
|
||||
rc = (filename[0] != '\0') ? open_file(filename, new_buffer, &f) :
|
||||
-2;
|
||||
|
||||
/* If we're loading into a new buffer, add a new entry to
|
||||
* openfile. */
|
||||
if (new_buffer)
|
||||
make_new_buffer();
|
||||
|
||||
/* If the filename isn't blank, open the file. Otherwise, treat it
|
||||
* as a new file. */
|
||||
rc = (filename[0] != '\0') ? open_file(filename, new_buffer, &f) :
|
||||
-2;
|
||||
|
||||
/* If we have a file, and we're loading into a new buffer, update
|
||||
* the filename. */
|
||||
if (rc != -1 && new_buffer)
|
||||
@@ -678,7 +881,7 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
|
||||
* found".
|
||||
*
|
||||
* Return -2 if we say "New File", -1 if the file isn't opened, and the
|
||||
* fd opened otherwise. The file might still have an error while reading
|
||||
* fd opened otherwise. The file might still have an error while reading
|
||||
* with a 0 return value. *f is set to the opened file. */
|
||||
int open_file(const char *filename, bool newfie, FILE **f)
|
||||
{
|
||||
@@ -693,10 +896,17 @@ int open_file(const char *filename, bool newfie, FILE **f)
|
||||
|
||||
/* Okay, if we can't stat the path due to a component's
|
||||
permissions, just try the relative one */
|
||||
if (full_filename == NULL
|
||||
if (full_filename == NULL
|
||||
|| (stat(full_filename, &fileinfo) == -1 && stat(filename, &fileinfo2) != -1))
|
||||
full_filename = mallocstrcpy(NULL, filename);
|
||||
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(LOCKING))
|
||||
if (do_lockfile(full_filename) < 0)
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
if (stat(full_filename, &fileinfo) == -1) {
|
||||
/* Well, maybe we can open the file even if the OS
|
||||
says its not there */
|
||||
@@ -1485,7 +1695,6 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
/* The actual file, realname, we are writing to. */
|
||||
char *tempname = NULL;
|
||||
/* The temp file name we write to on prepend. */
|
||||
int backup_cflags;
|
||||
|
||||
assert(name != NULL);
|
||||
|
||||
@@ -1548,6 +1757,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
char *backupname;
|
||||
struct utimbuf filetime;
|
||||
int copy_status;
|
||||
int backup_cflags;
|
||||
|
||||
/* Save the original file's access and modification times. */
|
||||
filetime.actime = openfile->current_stat->st_atime;
|
||||
@@ -1990,6 +2200,7 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Write the current file to disk. If the mark is on, write the current
|
||||
@@ -2402,9 +2613,6 @@ char **cwd_tab_completion(const char *buf, bool allow_files, size_t
|
||||
*num_matches, size_t buf_len)
|
||||
{
|
||||
char *dirname = mallocstrcpy(NULL, buf), *filename;
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
size_t dirnamelen;
|
||||
#endif
|
||||
size_t filenamelen;
|
||||
char **matches = NULL;
|
||||
DIR *dir;
|
||||
@@ -2443,9 +2651,6 @@ char **cwd_tab_completion(const char *buf, bool allow_files, size_t
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
dirnamelen = strlen(dirname);
|
||||
#endif
|
||||
filenamelen = strlen(filename);
|
||||
|
||||
while ((nextdir = readdir(dir)) != NULL) {
|
||||
|
||||
15
src/global.c
15
src/global.c
@@ -130,6 +130,11 @@ ssize_t tabsize = -1;
|
||||
#ifndef NANO_TINY
|
||||
char *backup_dir = NULL;
|
||||
/* The directory where we store backup files. */
|
||||
|
||||
const char *locking_prefix = ".";
|
||||
/* Prefix of how to store the vim-style lock file */
|
||||
const char *locking_suffix = ".swp";
|
||||
/* Suffix of the vim-style lock file */
|
||||
#endif
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
char *operating_dir = NULL;
|
||||
@@ -153,7 +158,7 @@ char *syntaxstr = NULL;
|
||||
#endif
|
||||
|
||||
bool edit_refresh_needed = 0;
|
||||
/* Did a command mangle enough of the buffer refresh that we
|
||||
/* Did a command mangle enough of the buffer refresh that we
|
||||
should repaint the screen */
|
||||
|
||||
const shortcut *currshortcut;
|
||||
@@ -374,7 +379,7 @@ void add_to_sclist(int menu, const char *scstring, void (*func)(void), int toggl
|
||||
|
||||
/* Return the given menu's first shortcut sequence, or the default value
|
||||
(2nd arg). Assumes currmenu for the menu to check*/
|
||||
int sc_seq_or (void (*func)(void), int defaultval)
|
||||
int sc_seq_or (void (*func)(void), int defaultval)
|
||||
{
|
||||
const sc *s = first_sc_for(currmenu, func);
|
||||
|
||||
@@ -385,7 +390,7 @@ int sc_seq_or (void (*func)(void), int defaultval)
|
||||
|
||||
}
|
||||
|
||||
/* Assign the info to the shortcut struct
|
||||
/* Assign the info to the shortcut struct
|
||||
Assumes keystr is already assigned, naturally */
|
||||
void assign_keyinfo(sc *s)
|
||||
{
|
||||
@@ -814,7 +819,7 @@ void shortcut_init(bool unjustify)
|
||||
|
||||
#ifndef NANO_TINY
|
||||
|
||||
add_to_funcs(do_mark, MMAIN, N_("Mark Text"),
|
||||
add_to_funcs(do_mark, MMAIN, N_("Mark Text"),
|
||||
IFSCHELP(nano_mark_msg), FALSE, VIEW);
|
||||
|
||||
add_to_funcs(do_research, (MMAIN|MBROWSER), whereis_next_msg,
|
||||
@@ -953,7 +958,7 @@ void shortcut_init(bool unjustify)
|
||||
IFSCHELP(nano_wordcount_msg), FALSE, VIEW);
|
||||
#endif
|
||||
|
||||
add_to_funcs(total_refresh, (MMAIN|MHELP), refresh_msg,
|
||||
add_to_funcs(total_refresh, (MMAIN|MHELP), refresh_msg,
|
||||
IFSCHELP(nano_refresh_msg), FALSE, VIEW);
|
||||
|
||||
add_to_funcs(do_suspend_void, MMAIN, suspend_msg,
|
||||
|
||||
@@ -79,7 +79,7 @@ void do_page_up(void)
|
||||
if (ISSET(SOFTWRAP) && openfile->current) {
|
||||
skipped += strlenpt(openfile->current->data) / COLS;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "do_page_up: i = %d, skipped = %d based on line %ld len %d\n", i, (unsigned long) skipped,
|
||||
fprintf(stderr, "do_page_up: i = %d, skipped = %d based on line %ld len %d\n", i, (unsigned long) skipped,
|
||||
openfile->current->lineno, strlenpt(openfile->current->data));
|
||||
#endif
|
||||
}
|
||||
|
||||
23
src/nano.c
23
src/nano.c
@@ -1,4 +1,4 @@
|
||||
/* $Id$ */
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* nano.c *
|
||||
* *
|
||||
@@ -520,6 +520,7 @@ openfilestruct *make_new_opennode(void)
|
||||
#ifndef NANO_TINY
|
||||
newnode->current_stat = NULL;
|
||||
newnode->last_action = OTHER;
|
||||
newnode->lock_filename = NULL;
|
||||
#endif
|
||||
|
||||
return newnode;
|
||||
@@ -845,6 +846,8 @@ void usage(void)
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
#ifndef NANO_TINY
|
||||
print_opt("-G", "--locking",
|
||||
N_("Use (vim-style) lock files"));
|
||||
print_opt("-H", "--historylog",
|
||||
N_("Log & read search/replace string history"));
|
||||
#endif
|
||||
@@ -1058,6 +1061,12 @@ void do_exit(void)
|
||||
/* If the user chose not to save, or if the user chose to save and
|
||||
* the save succeeded, we're ready to exit. */
|
||||
if (i == 0 || (i == 1 && do_writeout(TRUE))) {
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(LOCKING) && openfile->lock_filename)
|
||||
delete_lockfile(openfile->lock_filename);
|
||||
#endif /* NANO_TINY */
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* Exit only if there are no more open file buffers. */
|
||||
if (!close_buffer())
|
||||
@@ -2010,7 +2019,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Well we might also need a full refresh if we've changed the
|
||||
/* Well we might also need a full refresh if we've changed the
|
||||
line length to be a new multiple of COLS */
|
||||
if (ISSET(SOFTWRAP) && edit_refresh_needed == FALSE)
|
||||
if (strlenpt(openfile->current->data) / COLS != orig_lenpt / COLS)
|
||||
@@ -2098,6 +2107,7 @@ int main(int argc, char **argv)
|
||||
{"backup", 0, NULL, 'B'},
|
||||
{"backupdir", 1, NULL, 'C'},
|
||||
{"tabstospaces", 0, NULL, 'E'},
|
||||
{"locking", 0, NULL, 'G'},
|
||||
{"historylog", 0, NULL, 'H'},
|
||||
{"noconvert", 0, NULL, 'N'},
|
||||
{"poslog", 0, NULL, 'P'},
|
||||
@@ -2146,11 +2156,11 @@ int main(int argc, char **argv)
|
||||
while ((optchr =
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
getopt_long(argc, argv,
|
||||
"h?ABC:DEFHIKLNOPQ:RST:UVWY:abcdefgijklmo:pqr:s:tuvwxz$",
|
||||
"h?ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefgijklmo:pqr:s:tuvwxz$",
|
||||
long_options, NULL)
|
||||
#else
|
||||
getopt(argc, argv,
|
||||
"h?ABC:DEFHIKLNOPQ:RST:UVWY:abcdefgijklmo:pqr:s:tuvwxz$")
|
||||
"h?ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefgijklmo:pqr:s:tuvwxz$")
|
||||
#endif
|
||||
) != -1) {
|
||||
switch (optchr) {
|
||||
@@ -2188,6 +2198,9 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
#ifndef NANO_TINY
|
||||
case 'G':
|
||||
SET(LOCKING);
|
||||
break;
|
||||
case 'H':
|
||||
SET(HISTORYLOG);
|
||||
break;
|
||||
@@ -2449,7 +2462,7 @@ int main(int argc, char **argv)
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
/* Overwrite an rcfile "set nowrap" or --disable-wrapping-as-root
|
||||
if a --fill option was given on the command line. */
|
||||
if a --fill option was given on the command line. */
|
||||
if (fill_used)
|
||||
UNSET(NO_WRAP);
|
||||
#endif
|
||||
|
||||
11
src/nano.h
11
src/nano.h
@@ -85,6 +85,8 @@
|
||||
#define KEY_DC SL_KEY_DELETE
|
||||
#define KEY_IC SL_KEY_IC
|
||||
/* Ncurses support. */
|
||||
#elif defined(HAVE_NCURSESW_NCURSES_H)
|
||||
#include <ncursesw/ncurses.h>
|
||||
#elif defined(HAVE_NCURSES_H)
|
||||
#include <ncurses.h>
|
||||
#else
|
||||
@@ -372,6 +374,8 @@ typedef struct openfilestruct {
|
||||
undo *current_undo;
|
||||
/* The current (i.e. n ext) level of undo */
|
||||
undo_type last_action;
|
||||
const char *lock_filename;
|
||||
/* The path of the lockfile, if we created one */
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
syntaxtype *syntax;
|
||||
@@ -430,7 +434,7 @@ typedef struct sc {
|
||||
function_type type;
|
||||
/* What kind of function key is it for convenience later */
|
||||
int seq;
|
||||
/* The actual sequence to check on the the type is determined */
|
||||
/* The actual sequence to check on the type is determined */
|
||||
int menu;
|
||||
/* What list does this apply to */
|
||||
void (*scfunc)(void);
|
||||
@@ -467,7 +471,7 @@ typedef struct subnfunc {
|
||||
} subnfunc;
|
||||
|
||||
|
||||
/* Enumeration to be used in flags table. See FLAGBIT and FLAGOFF
|
||||
/* Enumeration to be used in flags table. See FLAGBIT and FLAGOFF
|
||||
* definitions. */
|
||||
enum
|
||||
{
|
||||
@@ -507,7 +511,8 @@ enum
|
||||
QUIET,
|
||||
UNDOABLE,
|
||||
SOFTWRAP,
|
||||
POS_HISTORY
|
||||
POS_HISTORY,
|
||||
LOCKING
|
||||
};
|
||||
|
||||
/* Flags for which menus in which a given function should be present */
|
||||
|
||||
@@ -85,6 +85,8 @@ extern ssize_t tabsize;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
extern char *backup_dir;
|
||||
extern const char *locking_prefix;
|
||||
extern const char *locking_suffix;
|
||||
#endif
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
extern char *operating_dir;
|
||||
@@ -253,6 +255,7 @@ void do_cut_text_void(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_copy_text(void);
|
||||
void do_cut_till_end(void);
|
||||
|
||||
#endif
|
||||
void do_uncut_text(void);
|
||||
|
||||
@@ -293,6 +296,8 @@ bool check_operating_dir(const char *currpath, bool allow_tabcomp);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
void init_backup_dir(void);
|
||||
int delete_lockfile(const char *lockfilename);
|
||||
int write_lockfile(const char *lockfilename, const char *origfilename, bool modified);
|
||||
#endif
|
||||
int copy_file(FILE *inn, FILE *out);
|
||||
bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
|
||||
20
src/rcfile.c
20
src/rcfile.c
@@ -41,6 +41,9 @@ static const rcoption rcopts[] = {
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
{"fill", 0},
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
{"locking", LOCKING},
|
||||
#endif
|
||||
#ifndef DISABLE_MOUSE
|
||||
{"mouse", USE_MOUSE},
|
||||
#endif
|
||||
@@ -249,7 +252,7 @@ bool nregcomp(const char *regex, int eflags)
|
||||
void parse_syntax(char *ptr)
|
||||
{
|
||||
const char *fileregptr = NULL, *nameptr = NULL;
|
||||
syntaxtype *tmpsyntax;
|
||||
syntaxtype *tmpsyntax, *prev_syntax;
|
||||
exttype *endext = NULL;
|
||||
/* The end of the extensions list for this syntax. */
|
||||
|
||||
@@ -276,15 +279,26 @@ void parse_syntax(char *ptr)
|
||||
|
||||
/* Search for a duplicate syntax name. If we find one, free it, so
|
||||
* that we always use the last syntax with a given name. */
|
||||
prev_syntax = NULL;
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
if (strcmp(nameptr, tmpsyntax->desc) == 0) {
|
||||
syntaxtype *prev_syntax = tmpsyntax;
|
||||
syntaxtype *old_syntax = tmpsyntax;
|
||||
|
||||
if (endsyntax == tmpsyntax)
|
||||
endsyntax = prev_syntax;
|
||||
|
||||
tmpsyntax = tmpsyntax->next;
|
||||
free(prev_syntax);
|
||||
if (prev_syntax != NULL)
|
||||
prev_syntax->next = tmpsyntax;
|
||||
else
|
||||
syntaxes = tmpsyntax;
|
||||
|
||||
free(old_syntax->desc);
|
||||
free(old_syntax);
|
||||
break;
|
||||
}
|
||||
prev_syntax = tmpsyntax;
|
||||
}
|
||||
|
||||
if (syntaxes == NULL) {
|
||||
|
||||
@@ -138,7 +138,6 @@ int search_init(bool replacing, bool use_answer)
|
||||
int i = 0;
|
||||
char *buf;
|
||||
sc *s;
|
||||
void (*func)(void);
|
||||
bool meta_key = FALSE, func_key = FALSE;
|
||||
static char *backupstring = NULL;
|
||||
/* The search string we'll be using. */
|
||||
@@ -220,6 +219,8 @@ int search_init(bool replacing, bool use_answer)
|
||||
statusbar(_("Cancelled"));
|
||||
return -1;
|
||||
} else {
|
||||
void (*func)(void);
|
||||
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if ((s->menu & currmenu) && i == s->seq) {
|
||||
func = s->scfunc;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id$ */
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* text.c *
|
||||
* *
|
||||
@@ -855,7 +855,7 @@ void add_undo(undo_type current_action)
|
||||
/* Ugh, if we were called while cutting not-to-end, non-marked and on the same lineno,
|
||||
we need to abort here */
|
||||
u = fs->current_undo;
|
||||
if (current_action == CUT && u && u->type == CUT
|
||||
if (current_action == CUT && u && u->type == CUT
|
||||
&& !u->mark_set && u->lineno == fs->current->lineno)
|
||||
return;
|
||||
|
||||
@@ -1979,6 +1979,8 @@ void do_justify(bool full_justify)
|
||||
if (full_justify)
|
||||
openfile->current = openfile->fileage;
|
||||
|
||||
allow_pending_sigwinch(FALSE);
|
||||
|
||||
while (TRUE) {
|
||||
size_t i;
|
||||
/* Generic loop variable. */
|
||||
@@ -2349,6 +2351,9 @@ void do_justify(bool full_justify)
|
||||
/* Display the shortcut list with UnCut. */
|
||||
shortcut_init(FALSE);
|
||||
display_main_list();
|
||||
|
||||
allow_pending_sigwinch(TRUE);
|
||||
|
||||
}
|
||||
|
||||
/* Justify the current paragraph. */
|
||||
|
||||
@@ -72,6 +72,10 @@ bool parse_num(const char *str, ssize_t *val)
|
||||
|
||||
assert(str != NULL);
|
||||
|
||||
/* Man page for strtol() says this is required, and
|
||||
it looks like it is! */
|
||||
errno = 0;
|
||||
|
||||
j = (ssize_t)strtol(str, &first_error, 10);
|
||||
|
||||
if (errno == ERANGE || *str == '\0' || *first_error != '\0')
|
||||
|
||||
15
src/winio.c
15
src/winio.c
@@ -1800,7 +1800,7 @@ const sc *get_shortcut(int menu, int *kbinput, bool
|
||||
|
||||
|
||||
/* Try to get a function back from a window. Just a wrapper so
|
||||
functions to need to create function_key meta_key blah blah
|
||||
functions to need to create function_key meta_key blah blah
|
||||
mmenu - what menu name to look through for valid funcs */
|
||||
const subnfunc *getfuncfromkey(WINDOW *win)
|
||||
{
|
||||
@@ -2258,6 +2258,17 @@ void set_modified(void)
|
||||
if (!openfile->modified) {
|
||||
openfile->modified = TRUE;
|
||||
titlebar(NULL);
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(LOCKING)) {
|
||||
if (openfile->lock_filename == NULL) {
|
||||
/* Translators: Try to keep this at most 80 characters. */
|
||||
statusbar(_("Warning: Modifying a file which is not locked, check directory permission?"));
|
||||
} else {
|
||||
write_lockfile(openfile->lock_filename,
|
||||
get_full_path(openfile->filename), TRUE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3124,7 +3135,6 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
|
||||
fprintf(stderr, "edit_redraw(): line %lu was offscreen, oldcurrent = %lu edittop = %lu", openfile->current->lineno,
|
||||
old_current->lineno, openfile->edittop->lineno);
|
||||
#endif
|
||||
filestruct *old_edittop = openfile->edittop;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If the mark is on, update all the lines between old_current
|
||||
@@ -3132,6 +3142,7 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
|
||||
* whether we've scrolled up or down) of the edit window. */
|
||||
if (openfile->mark_set) {
|
||||
ssize_t old_lineno;
|
||||
filestruct *old_edittop = openfile->edittop;
|
||||
|
||||
if (old_edittop->lineno < openfile->edittop->lineno)
|
||||
old_lineno = old_edittop->lineno;
|
||||
|
||||
Reference in New Issue
Block a user