miscellaneous minor fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3201 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
d15c92d41a
Коммит
ccd1b7b50a
@ -113,6 +113,13 @@ CVS code -
|
|||||||
prompt. New functions find_statusbar_bracket_match() and
|
prompt. New functions find_statusbar_bracket_match() and
|
||||||
do_statusbar_find_bracket(); changes to do_statusbar_input().
|
do_statusbar_find_bracket(); changes to do_statusbar_input().
|
||||||
(DLR)
|
(DLR)
|
||||||
|
- Beep whenever we can't read a file or directory and have to
|
||||||
|
indicate it on the statusbar, as Pico does. Changes to
|
||||||
|
do_browser(), open_file(), and write_file(). (DLR)
|
||||||
|
- browser.c:
|
||||||
|
do_browser()
|
||||||
|
- When setting the width of each file, use the "?" operator
|
||||||
|
instead of an if/else clause. (DLR)
|
||||||
- chars.c:
|
- chars.c:
|
||||||
mbwidth()
|
mbwidth()
|
||||||
- If wcwidth() returns -1 for the character passed in, treat the
|
- If wcwidth() returns -1 for the character passed in, treat the
|
||||||
|
@ -207,6 +207,8 @@ char *do_browser(char *path, DIR *dir)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (stat(filelist[selected], &st) == -1) {
|
if (stat(filelist[selected], &st) == -1) {
|
||||||
|
/* We can't open this file for some reason.
|
||||||
|
* Complain. */
|
||||||
statusbar(_("Error reading %s: %s"),
|
statusbar(_("Error reading %s: %s"),
|
||||||
filelist[selected], strerror(errno));
|
filelist[selected], strerror(errno));
|
||||||
beep();
|
beep();
|
||||||
@ -225,6 +227,7 @@ char *do_browser(char *path, DIR *dir)
|
|||||||
* Complain. */
|
* Complain. */
|
||||||
statusbar(_("Error reading %s: %s"),
|
statusbar(_("Error reading %s: %s"),
|
||||||
filelist[selected], strerror(errno));
|
filelist[selected], strerror(errno));
|
||||||
|
beep();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,6 +287,7 @@ char *do_browser(char *path, DIR *dir)
|
|||||||
* Complain. */
|
* Complain. */
|
||||||
statusbar(_("Error reading %s: %s"), answer,
|
statusbar(_("Error reading %s: %s"), answer,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
beep();
|
||||||
free(new_path);
|
free(new_path);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -308,11 +312,8 @@ char *do_browser(char *path, DIR *dir)
|
|||||||
|
|
||||||
blank_edit();
|
blank_edit();
|
||||||
|
|
||||||
if (width != 0)
|
j = (width != 0) ? width * editwinrows * ((selected / width) /
|
||||||
j = width * editwinrows *
|
editwinrows) : 0;
|
||||||
((selected / width) / editwinrows);
|
|
||||||
else
|
|
||||||
j = 0;
|
|
||||||
|
|
||||||
wmove(edit, 0, 0);
|
wmove(edit, 0, 0);
|
||||||
|
|
||||||
|
12
src/files.c
12
src/files.c
@ -595,6 +595,7 @@ int open_file(const char *filename, bool newfie, FILE **f)
|
|||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
statusbar(_("\"%s\" not found"), filename);
|
statusbar(_("\"%s\" not found"), filename);
|
||||||
|
beep();
|
||||||
return -1;
|
return -1;
|
||||||
} else if (S_ISDIR(fileinfo.st_mode) || S_ISCHR(fileinfo.st_mode) ||
|
} else if (S_ISDIR(fileinfo.st_mode) || S_ISCHR(fileinfo.st_mode) ||
|
||||||
S_ISBLK(fileinfo.st_mode)) {
|
S_ISBLK(fileinfo.st_mode)) {
|
||||||
@ -602,9 +603,11 @@ int open_file(const char *filename, bool newfie, FILE **f)
|
|||||||
statusbar(S_ISDIR(fileinfo.st_mode) ?
|
statusbar(S_ISDIR(fileinfo.st_mode) ?
|
||||||
_("\"%s\" is a directory") :
|
_("\"%s\" is a directory") :
|
||||||
_("File \"%s\" is a device file"), filename);
|
_("File \"%s\" is a device file"), filename);
|
||||||
|
beep();
|
||||||
return -1;
|
return -1;
|
||||||
} else if ((fd = open(filename, O_RDONLY)) == -1) {
|
} else if ((fd = open(filename, O_RDONLY)) == -1) {
|
||||||
statusbar(_("Error reading %s: %s"), filename, strerror(errno));
|
statusbar(_("Error reading %s: %s"), filename, strerror(errno));
|
||||||
|
beep();
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
/* File is A-OK. Open it in binary mode for our own end-of-line
|
/* File is A-OK. Open it in binary mode for our own end-of-line
|
||||||
@ -614,6 +617,7 @@ int open_file(const char *filename, bool newfie, FILE **f)
|
|||||||
if (*f == NULL) {
|
if (*f == NULL) {
|
||||||
statusbar(_("Error reading %s: %s"), filename,
|
statusbar(_("Error reading %s: %s"), filename,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
beep();
|
||||||
close(fd);
|
close(fd);
|
||||||
} else
|
} else
|
||||||
statusbar(_("Reading File"));
|
statusbar(_("Reading File"));
|
||||||
@ -1322,6 +1326,7 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
statusbar(_("Error reading %s: %s"), realname,
|
statusbar(_("Error reading %s: %s"), realname,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
beep();
|
||||||
goto cleanup_and_exit;
|
goto cleanup_and_exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1401,10 +1406,11 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||||||
openfile->current_stat->st_gid) == -1 ||
|
openfile->current_stat->st_gid) == -1 ||
|
||||||
utime(backupname, &filetime) == -1) {
|
utime(backupname, &filetime) == -1) {
|
||||||
free(backupname);
|
free(backupname);
|
||||||
if (copy_status == -1)
|
if (copy_status == -1) {
|
||||||
statusbar(_("Error reading %s: %s"), realname,
|
statusbar(_("Error reading %s: %s"), realname,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
else
|
beep();
|
||||||
|
} else
|
||||||
statusbar(_("Error writing %s: %s"), backupname,
|
statusbar(_("Error writing %s: %s"), backupname,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
goto cleanup_and_exit;
|
goto cleanup_and_exit;
|
||||||
@ -1455,6 +1461,7 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||||||
if (f_source == NULL) {
|
if (f_source == NULL) {
|
||||||
statusbar(_("Error reading %s: %s"), realname,
|
statusbar(_("Error reading %s: %s"), realname,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
beep();
|
||||||
close(fd_source);
|
close(fd_source);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
unlink(tempname);
|
unlink(tempname);
|
||||||
@ -1576,6 +1583,7 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||||||
if (f_source == NULL) {
|
if (f_source == NULL) {
|
||||||
statusbar(_("Error reading %s: %s"), tempname,
|
statusbar(_("Error reading %s: %s"), tempname,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
beep();
|
||||||
fclose(f);
|
fclose(f);
|
||||||
goto cleanup_and_exit;
|
goto cleanup_and_exit;
|
||||||
}
|
}
|
||||||
|
@ -1446,8 +1446,8 @@ void do_justify(bool full_justify)
|
|||||||
/* Partition the filestruct so that it contains only the
|
/* Partition the filestruct so that it contains only the
|
||||||
* text of the justified paragraph. */
|
* text of the justified paragraph. */
|
||||||
filepart = partition_filestruct(first_par_line, 0,
|
filepart = partition_filestruct(first_par_line, 0,
|
||||||
last_par_line, (filebot_inpar && last_par_line ==
|
last_par_line, filebot_inpar ?
|
||||||
openfile->filebot) ? strlen(last_par_line->data) : 0);
|
strlen(last_par_line->data) : 0);
|
||||||
|
|
||||||
/* Remove the text of the justified paragraph, and
|
/* Remove the text of the justified paragraph, and
|
||||||
* replace it with the text in the justify buffer. */
|
* replace it with the text in the justify buffer. */
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user