per DB's patch (with a few updates of mine), convert the shortcut list
functions and most related functions to return void instead of int, as the return values of all those functions are essentially unused; also add a few related miscellaneous cleanups git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1836 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
74912c6090
commit
72e51ab037
17
ChangeLog
17
ChangeLog
|
@ -5,13 +5,26 @@ CVS code -
|
|||
FALSE. (David Benbennick and DLR)
|
||||
- Change more instances of ints that can never be negative to
|
||||
size_t's. (DLR)
|
||||
- Convert the shortcut list functions and most related functions
|
||||
to return void instead of int, as the return values of all
|
||||
those functions are essentially unused. Changes to
|
||||
sc_init_one(), shortcut_init(), etc. (David Benbennick and
|
||||
DLR)
|
||||
- files.c:
|
||||
close_open_file()
|
||||
- Tweak to no longer rely on the return values of
|
||||
open_(prev|next)file(). (DLR)
|
||||
- global.c:
|
||||
shortcut_init()
|
||||
- Fix erroneous #ifdef so that nano compiles with
|
||||
--disable-justify again. (DLR; found by Mike Frysinger)
|
||||
- nano.c:
|
||||
do_exit()
|
||||
- Tweak for efficiency. (David Benbennick)
|
||||
- proto.h:
|
||||
- Change the last variable in the prototype for get_mouseinput()
|
||||
to match the one used in the actual function. (DLR)
|
||||
- Change the last variables in the prototypes for do_justify()
|
||||
and get_mouseinput() to match the ones used in the actual
|
||||
functions. (DLR)
|
||||
- rcfile.c:
|
||||
parse_rcfile()
|
||||
- Have whitespace display default to off instead of on. (Mike
|
||||
|
|
23
src/cut.c
23
src/cut.c
|
@ -199,7 +199,7 @@ void cut_marked_segment(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
int do_cut_text(void)
|
||||
void do_cut_text(void)
|
||||
{
|
||||
filestruct *fileptr;
|
||||
|
||||
|
@ -226,7 +226,7 @@ int do_cut_text(void)
|
|||
&& !ISSET(MARK_ISSET)
|
||||
#endif
|
||||
)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
keep_cutbuffer = TRUE;
|
||||
|
||||
|
@ -251,7 +251,7 @@ int do_cut_text(void)
|
|||
|
||||
do_delete();
|
||||
marked_cut = 2;
|
||||
return 1;
|
||||
return;
|
||||
} else {
|
||||
SET(MARK_ISSET);
|
||||
|
||||
|
@ -274,8 +274,7 @@ int do_cut_text(void)
|
|||
marked_cut = 1;
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
|
@ -305,10 +304,9 @@ int do_cut_text(void)
|
|||
#ifndef NANO_SMALL
|
||||
concatenate_cut = FALSE;
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_uncut_text(void)
|
||||
void do_uncut_text(void)
|
||||
{
|
||||
filestruct *tmp = current;
|
||||
filestruct *newbuf = NULL;
|
||||
|
@ -319,7 +317,7 @@ int do_uncut_text(void)
|
|||
#endif
|
||||
check_statblank();
|
||||
if (cutbuffer == NULL || current == NULL)
|
||||
return 0; /* AIEEEEEEEEEEEE */
|
||||
return; /* AIEEEEEEEEEEEE */
|
||||
|
||||
/* If we're uncutting a previously non-marked block, uncut to end if
|
||||
* we're not at the beginning of the line. If we are at the
|
||||
|
@ -410,11 +408,9 @@ int do_uncut_text(void)
|
|||
current = newend;
|
||||
}
|
||||
|
||||
/* If marked cut == 2, that means that we're doing a cut to end
|
||||
/* If marked cut == 2, it means that we're doing a cut to end
|
||||
* and we don't want anything else on the line, so we have to
|
||||
* screw up all the work we just did and separate the line.
|
||||
* There must be a better way to do this, but not at 1 AM on a
|
||||
* work night. */
|
||||
* screw up all the work we just did and separate the line. */
|
||||
if (marked_cut == 2) {
|
||||
tmp = make_new_node(current);
|
||||
tmp->data = mallocstrcpy(NULL, current->data + current_x);
|
||||
|
@ -437,7 +433,7 @@ int do_uncut_text(void)
|
|||
#endif
|
||||
set_modified();
|
||||
edit_refresh();
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (current != fileage) {
|
||||
|
@ -468,5 +464,4 @@ int do_uncut_text(void)
|
|||
#endif
|
||||
|
||||
set_modified();
|
||||
return 1;
|
||||
}
|
||||
|
|
118
src/files.c
118
src/files.c
|
@ -86,7 +86,7 @@ void new_file(void)
|
|||
on the command line, a new file will be created, but it will be
|
||||
given no open_files entry */
|
||||
if (open_files == NULL) {
|
||||
add_open_file(0);
|
||||
add_open_file(FALSE);
|
||||
/* turn off view mode in this case; this is for consistency
|
||||
whether multibuffers are compiled in or not */
|
||||
UNSET(VIEW_MODE);
|
||||
|
@ -424,7 +424,7 @@ char *get_next_filename(const char *name)
|
|||
return buf;
|
||||
}
|
||||
|
||||
int do_insertfile(int loading_file)
|
||||
void do_insertfile(int loading_file)
|
||||
{
|
||||
int i, old_current_x = current_x;
|
||||
char *realname = NULL;
|
||||
|
@ -507,7 +507,7 @@ int do_insertfile(int loading_file)
|
|||
if (ts == -1 || answer == NULL || answer[0] == '\0') {
|
||||
statusbar(_("Cancelled"));
|
||||
display_main_list();
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
|
@ -529,17 +529,17 @@ int do_insertfile(int loading_file)
|
|||
#ifndef NANO_SMALL
|
||||
i != NANO_EXTCMD_KEY &&
|
||||
#endif
|
||||
check_operating_dir(answer, 0) != 0) {
|
||||
check_operating_dir(answer, FALSE) != 0) {
|
||||
statusbar(_("Can't insert file from outside of %s"),
|
||||
operating_dir);
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (loading_file) {
|
||||
/* update the current entry in the open_files structure */
|
||||
add_open_file(1);
|
||||
add_open_file(TRUE);
|
||||
new_file();
|
||||
UNSET(MODIFIED);
|
||||
#ifndef NANO_SMALL
|
||||
|
@ -584,7 +584,7 @@ int do_insertfile(int loading_file)
|
|||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (loading_file)
|
||||
load_file(0);
|
||||
load_file(FALSE);
|
||||
else
|
||||
#endif
|
||||
set_modified();
|
||||
|
@ -627,27 +627,24 @@ int do_insertfile(int loading_file)
|
|||
inspath = NULL;
|
||||
|
||||
display_main_list();
|
||||
return i;
|
||||
}
|
||||
|
||||
int do_insertfile_void(void)
|
||||
void do_insertfile_void(void)
|
||||
{
|
||||
int result = 0;
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (ISSET(VIEW_MODE)) {
|
||||
if (ISSET(MULTIBUFFER))
|
||||
result = do_insertfile(1);
|
||||
do_insertfile(TRUE);
|
||||
else
|
||||
statusbar(_("Key illegal in non-multibuffer mode"));
|
||||
}
|
||||
else
|
||||
result = do_insertfile(ISSET(MULTIBUFFER));
|
||||
do_insertfile(ISSET(MULTIBUFFER));
|
||||
#else
|
||||
result = do_insertfile(0);
|
||||
do_insertfile(FALSE);
|
||||
#endif
|
||||
|
||||
display_main_list();
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
|
@ -722,15 +719,15 @@ void free_openfilestruct(openfilestruct *src)
|
|||
|
||||
/*
|
||||
* Add/update an entry to the open_files openfilestruct. If update is
|
||||
* zero, a new entry is created; otherwise, the current entry is updated.
|
||||
* Return 0 on success or 1 on error.
|
||||
* FALSE, a new entry is created; otherwise, the current entry is
|
||||
* updated.
|
||||
*/
|
||||
int add_open_file(int update)
|
||||
void add_open_file(int update)
|
||||
{
|
||||
openfilestruct *tmp;
|
||||
|
||||
if (fileage == NULL || current == NULL || filename == NULL)
|
||||
return 1;
|
||||
return;
|
||||
|
||||
/* if no entries, make the first one */
|
||||
if (open_files == NULL)
|
||||
|
@ -805,19 +802,16 @@ int add_open_file(int update)
|
|||
#ifdef DEBUG
|
||||
fprintf(stderr, "filename is %s\n", open_files->filename);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the current entry in the open_files structure and set up the
|
||||
* currently open file using that entry's information. Return 0 on
|
||||
* success or 1 on error.
|
||||
* currently open file using that entry's information.
|
||||
*/
|
||||
int load_open_file(void)
|
||||
void load_open_file(void)
|
||||
{
|
||||
if (open_files == NULL)
|
||||
return 1;
|
||||
return;
|
||||
|
||||
/* set up the filename, the file buffer, the total number of lines in
|
||||
the file, and the total file size */
|
||||
|
@ -858,33 +852,30 @@ int load_open_file(void)
|
|||
/* update the titlebar */
|
||||
clearok(topwin, FALSE);
|
||||
titlebar(NULL);
|
||||
|
||||
/* now we're done */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Open the previous entry in the open_files structure. If closing_file
|
||||
* is zero, update the current entry before switching from it.
|
||||
* Otherwise, we are about to close that entry, so don't bother doing so.
|
||||
* Return 0 on success and 1 on error.
|
||||
* is FALSE, update the current entry before switching from it.
|
||||
* Otherwise, we are about to close that entry, so don't bother doing
|
||||
* so.
|
||||
*/
|
||||
int open_prevfile(int closing_file)
|
||||
void open_prevfile(int closing_file)
|
||||
{
|
||||
if (open_files == NULL)
|
||||
return 1;
|
||||
return;
|
||||
|
||||
/* if we're not about to close the current entry, update it before
|
||||
doing anything */
|
||||
if (!closing_file)
|
||||
add_open_file(1);
|
||||
add_open_file(TRUE);
|
||||
|
||||
if (open_files->prev == NULL && open_files->next == NULL) {
|
||||
|
||||
/* only one file open */
|
||||
if (!closing_file)
|
||||
statusbar(_("No more open file buffers"));
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (open_files->prev != NULL) {
|
||||
|
@ -911,43 +902,40 @@ int open_prevfile(int closing_file)
|
|||
load_open_file();
|
||||
|
||||
statusbar(_("Switched to %s"),
|
||||
((open_files->filename[0] == '\0') ? "New Buffer" : open_files->filename));
|
||||
((open_files->filename[0] == '\0') ? "New Buffer" :
|
||||
open_files->filename));
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_buffer(current);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This function is used by the shortcut list. */
|
||||
int open_prevfile_void(void)
|
||||
void open_prevfile_void(void)
|
||||
{
|
||||
return open_prevfile(0);
|
||||
open_prevfile(FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Open the next entry in the open_files structure. If closing_file is
|
||||
* zero, update the current entry before switching from it. Otherwise, we
|
||||
* are about to close that entry, so don't bother doing so. Return 0 on
|
||||
* success and 1 on error.
|
||||
* FALSE, update the current entry before switching from it. Otherwise,
|
||||
* we are about to close that entry, so don't bother doing so.
|
||||
*/
|
||||
int open_nextfile(int closing_file)
|
||||
void open_nextfile(int closing_file)
|
||||
{
|
||||
if (open_files == NULL)
|
||||
return 1;
|
||||
return;
|
||||
|
||||
/* if we're not about to close the current entry, update it before
|
||||
doing anything */
|
||||
if (!closing_file)
|
||||
add_open_file(1);
|
||||
add_open_file(TRUE);
|
||||
|
||||
if (open_files->prev == NULL && open_files->next == NULL) {
|
||||
|
||||
/* only one file open */
|
||||
if (!closing_file)
|
||||
statusbar(_("No more open file buffers"));
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (open_files->next != NULL) {
|
||||
|
@ -974,19 +962,17 @@ int open_nextfile(int closing_file)
|
|||
load_open_file();
|
||||
|
||||
statusbar(_("Switched to %s"),
|
||||
((open_files->filename[0] == '\0') ? "New Buffer" : open_files->filename));
|
||||
((open_files->filename[0] == '\0') ? "New Buffer" :
|
||||
open_files->filename));
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_buffer(current);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This function is used by the shortcut list. */
|
||||
int open_nextfile_void(void)
|
||||
void open_nextfile_void(void)
|
||||
{
|
||||
return open_nextfile(0);
|
||||
open_nextfile(FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1008,10 +994,12 @@ int close_open_file(void)
|
|||
open_files->filebot = filebot;
|
||||
|
||||
tmp = open_files;
|
||||
if (open_nextfile(1)) {
|
||||
if (open_prevfile(1))
|
||||
if (open_files->next != NULL)
|
||||
open_nextfile(TRUE);
|
||||
else if (open_files->prev != NULL)
|
||||
open_prevfile(TRUE);
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
unlink_opennode(tmp);
|
||||
delete_opennode(tmp);
|
||||
|
@ -1437,7 +1425,7 @@ int write_file(const char *name, int tmp, int append, int nonamechange)
|
|||
#ifndef DISABLE_OPERATINGDIR
|
||||
/* If we're writing a temporary file, we're probably going outside
|
||||
* the operating directory, so skip the operating directory test. */
|
||||
if (!tmp && check_operating_dir(realname, 0) != 0) {
|
||||
if (!tmp && check_operating_dir(realname, FALSE) != 0) {
|
||||
statusbar(_("Can't write outside of %s"), operating_dir);
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
@ -1958,16 +1946,16 @@ int do_writeout(int exiting)
|
|||
/* If we're not about to exit, update the current entry in
|
||||
* the open_files structure. */
|
||||
if (!exiting)
|
||||
add_open_file(1);
|
||||
add_open_file(TRUE);
|
||||
#endif
|
||||
display_main_list();
|
||||
return i;
|
||||
} /* while (TRUE) */
|
||||
}
|
||||
|
||||
int do_writeout_void(void)
|
||||
void do_writeout_void(void)
|
||||
{
|
||||
return do_writeout(FALSE);
|
||||
do_writeout(FALSE);
|
||||
}
|
||||
|
||||
/* Return a malloc()ed string containing the actual directory, used
|
||||
|
@ -2075,7 +2063,7 @@ char **username_tab_completion(char *buf, int *num_matches)
|
|||
directory, in which case just go to the next match */
|
||||
|
||||
if (operating_dir != NULL) {
|
||||
if (check_operating_dir(userdata->pw_dir, 1) != 0)
|
||||
if (check_operating_dir(userdata->pw_dir, TRUE) != 0)
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
@ -2183,7 +2171,7 @@ char **cwd_tab_completion(char *buf, int *num_matches)
|
|||
strcpy(tmp2, dirname);
|
||||
strcat(tmp2, "/");
|
||||
strcat(tmp2, next->d_name);
|
||||
if (check_operating_dir(tmp2, 1) != 0) {
|
||||
if (check_operating_dir(tmp2, TRUE) != 0) {
|
||||
free(tmp2);
|
||||
continue;
|
||||
}
|
||||
|
@ -2696,7 +2684,7 @@ char *do_browser(const char *inpath)
|
|||
/* Note: the selected file can be outside the operating
|
||||
* directory if it is .. or if it is a symlink to
|
||||
* directory outside the operating directory. */
|
||||
if (check_operating_dir(filelist[selected], 0) != 0) {
|
||||
if (check_operating_dir(filelist[selected], FALSE) != 0) {
|
||||
statusbar(_("Can't go outside of %s in restricted mode"), operating_dir);
|
||||
beep();
|
||||
break;
|
||||
|
@ -2769,7 +2757,7 @@ char *do_browser(const char *inpath)
|
|||
}
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
if (check_operating_dir(new_path, 0) != 0) {
|
||||
if (check_operating_dir(new_path, FALSE) != 0) {
|
||||
statusbar(_("Can't go outside of %s in restricted mode"), operating_dir);
|
||||
free(new_path);
|
||||
break;
|
||||
|
@ -2912,7 +2900,7 @@ char *do_browse_from(const char *inpath)
|
|||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
/* If the resulting path isn't in the operating directory, use that. */
|
||||
if (check_operating_dir(path, 0) != 0)
|
||||
if (check_operating_dir(path, FALSE) != 0)
|
||||
path = mallocstrcpy(path, operating_dir);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc,
|
|||
#ifndef DISABLE_HELP
|
||||
const char *help,
|
||||
#endif
|
||||
int metaval, int funcval, int miscval, int view, int
|
||||
int metaval, int funcval, int miscval, int view, void
|
||||
(*func)(void))
|
||||
{
|
||||
shortcut *s;
|
||||
|
|
46
src/move.c
46
src/move.c
|
@ -28,7 +28,7 @@
|
|||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
int do_first_line(void)
|
||||
void do_first_line(void)
|
||||
{
|
||||
int old_pww = placewewant;
|
||||
current = fileage;
|
||||
|
@ -36,10 +36,9 @@ int do_first_line(void)
|
|||
current_x = 0;
|
||||
if (edittop != fileage || need_vertical_update(old_pww))
|
||||
edit_update(current, TOP);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_last_line(void)
|
||||
void do_last_line(void)
|
||||
{
|
||||
int old_pww = placewewant;
|
||||
current = filebot;
|
||||
|
@ -48,10 +47,9 @@ int do_last_line(void)
|
|||
if (edittop->lineno + (editwinrows / 2) != filebot->lineno ||
|
||||
need_vertical_update(old_pww))
|
||||
edit_update(current, CENTER);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_home(void)
|
||||
void do_home(void)
|
||||
{
|
||||
int old_pww = placewewant;
|
||||
#ifndef NANO_SMALL
|
||||
|
@ -76,10 +74,9 @@ int do_home(void)
|
|||
check_statblank();
|
||||
if (need_horizontal_update(old_pww))
|
||||
update_line(current, current_x);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_end(void)
|
||||
void do_end(void)
|
||||
{
|
||||
int old_pww = placewewant;
|
||||
current_x = strlen(current->data);
|
||||
|
@ -87,10 +84,9 @@ int do_end(void)
|
|||
check_statblank();
|
||||
if (need_horizontal_update(old_pww))
|
||||
update_line(current, current_x);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_page_up(void)
|
||||
void do_page_up(void)
|
||||
{
|
||||
int old_pww = placewewant;
|
||||
const filestruct *old_current = current;
|
||||
|
@ -134,10 +130,9 @@ int do_page_up(void)
|
|||
edit_redraw(old_current, old_pww);
|
||||
|
||||
check_statblank();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_page_down(void)
|
||||
void do_page_down(void)
|
||||
{
|
||||
int old_pww = placewewant;
|
||||
const filestruct *old_current = current;
|
||||
|
@ -182,10 +177,9 @@ int do_page_down(void)
|
|||
edit_redraw(old_current, old_pww);
|
||||
|
||||
check_statblank();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_up(void)
|
||||
void do_up(void)
|
||||
{
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
|
@ -193,7 +187,7 @@ int do_up(void)
|
|||
check_statblank();
|
||||
|
||||
if (current->prev == NULL)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
assert(current_y == current->lineno - edittop->lineno);
|
||||
current = current->prev;
|
||||
|
@ -216,13 +210,9 @@ int do_up(void)
|
|||
if (need_vertical_update(0))
|
||||
update_line(current->next, 0);
|
||||
update_line(current, current_x);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Return value 1 means we moved down, 0 means we were already at the
|
||||
* bottom. */
|
||||
int do_down(void)
|
||||
void do_down(void)
|
||||
{
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
|
@ -230,7 +220,7 @@ int do_down(void)
|
|||
check_statblank();
|
||||
|
||||
if (current->next == NULL)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
assert(current_y == current->lineno - edittop->lineno);
|
||||
current = current->next;
|
||||
|
@ -253,11 +243,9 @@ int do_down(void)
|
|||
if (need_vertical_update(0))
|
||||
update_line(current->prev, 0);
|
||||
update_line(current, current_x);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_left(int allow_update)
|
||||
void do_left(int allow_update)
|
||||
{
|
||||
int old_pww = placewewant;
|
||||
if (current_x > 0)
|
||||
|
@ -270,15 +258,14 @@ int do_left(int allow_update)
|
|||
check_statblank();
|
||||
if (allow_update && need_horizontal_update(old_pww))
|
||||
update_line(current, current_x);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_left_void(void)
|
||||
void do_left_void(void)
|
||||
{
|
||||
return do_left(TRUE);
|
||||
do_left(TRUE);
|
||||
}
|
||||
|
||||
int do_right(int allow_update)
|
||||
void do_right(int allow_update)
|
||||
{
|
||||
int old_pww = placewewant;
|
||||
assert(current_x <= strlen(current->data));
|
||||
|
@ -293,10 +280,9 @@ int do_right(int allow_update)
|
|||
check_statblank();
|
||||
if (allow_update && need_horizontal_update(old_pww))
|
||||
update_line(current, current_x);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_right_void(void)
|
||||
void do_right_void(void)
|
||||
{
|
||||
return do_right(TRUE);
|
||||
do_right(TRUE);
|
||||
}
|
||||
|
|
118
src/nano.c
118
src/nano.c
|
@ -772,10 +772,9 @@ int no_help(void)
|
|||
return ISSET(NO_HELP) ? 2 : 0;
|
||||
}
|
||||
|
||||
int nano_disabled_msg(void)
|
||||
void nano_disabled_msg(void)
|
||||
{
|
||||
statusbar(_("Sorry, support for this function has been disabled"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
|
@ -988,7 +987,7 @@ void do_char(char ch)
|
|||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
int do_verbatim_input(void)
|
||||
void do_verbatim_input(void)
|
||||
{
|
||||
int *v_kbinput = NULL; /* Used to hold verbatim input. */
|
||||
size_t v_len; /* Length of verbatim input. */
|
||||
|
@ -1007,20 +1006,17 @@ int do_verbatim_input(void)
|
|||
UNSET(DISABLE_CURPOS);
|
||||
|
||||
free(v_kbinput);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_backspace(void)
|
||||
void do_backspace(void)
|
||||
{
|
||||
if (current != fileage || current_x > 0) {
|
||||
do_left(FALSE);
|
||||
do_delete();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_delete(void)
|
||||
void do_delete(void)
|
||||
{
|
||||
int do_refresh = FALSE;
|
||||
/* Do we have to call edit_refresh(), or can we get away with
|
||||
|
@ -1076,7 +1072,7 @@ int do_delete(void)
|
|||
totlines--;
|
||||
wrap_reset();
|
||||
} else
|
||||
return 0;
|
||||
return;
|
||||
|
||||
totsize--;
|
||||
set_modified();
|
||||
|
@ -1092,18 +1088,15 @@ int do_delete(void)
|
|||
edit_refresh();
|
||||
else
|
||||
update_line(current, current_x);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_tab(void)
|
||||
void do_tab(void)
|
||||
{
|
||||
do_char('\t');
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Someone hits return *gasp!* */
|
||||
int do_enter(void)
|
||||
void do_enter(void)
|
||||
{
|
||||
filestruct *newnode = make_new_node(current);
|
||||
size_t extra = 0;
|
||||
|
@ -1159,12 +1152,10 @@ int do_enter(void)
|
|||
totlines++;
|
||||
set_modified();
|
||||
placewewant = xplustabs();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
int do_next_word(void)
|
||||
void do_next_word(void)
|
||||
{
|
||||
int old_pww = placewewant;
|
||||
const filestruct *current_save = current;
|
||||
|
@ -1193,12 +1184,10 @@ int do_next_word(void)
|
|||
/* Refresh the screen. If current has run off the bottom, this
|
||||
* call puts it at the center line. */
|
||||
edit_redraw(current_save, old_pww);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The same thing for backwards. */
|
||||
int do_prev_word(void)
|
||||
void do_prev_word(void)
|
||||
{
|
||||
int old_pww = placewewant;
|
||||
const filestruct *current_save = current;
|
||||
|
@ -1232,11 +1221,9 @@ int do_prev_word(void)
|
|||
/* Refresh the screen. If current has run off the top, this call
|
||||
* puts it at the center line. */
|
||||
edit_redraw(current_save, old_pww);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int do_mark(void)
|
||||
void do_mark(void)
|
||||
{
|
||||
TOGGLE(MARK_ISSET);
|
||||
if (ISSET(MARK_ISSET)) {
|
||||
|
@ -1247,7 +1234,6 @@ int do_mark(void)
|
|||
statusbar(_("Mark UNset"));
|
||||
edit_refresh();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
|
@ -1833,7 +1819,7 @@ const char *do_alt_speller(char *tempfile_name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int do_spell(void)
|
||||
void do_spell(void)
|
||||
{
|
||||
int i;
|
||||
char *temp = safe_tempnam(0, "nano.");
|
||||
|
@ -1841,7 +1827,7 @@ int do_spell(void)
|
|||
|
||||
if (temp == NULL) {
|
||||
statusbar(_("Could not create temp file: %s"), strerror(errno));
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
|
@ -1854,13 +1840,13 @@ int do_spell(void)
|
|||
if (i == -1) {
|
||||
statusbar(_("Unable to write temp file: %s"), strerror(errno));
|
||||
free(temp);
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* Update the current open_files entry before spell-checking, in
|
||||
* case any problems occur. */
|
||||
add_open_file(1);
|
||||
add_open_file(TRUE);
|
||||
#endif
|
||||
|
||||
spell_msg = alt_speller != NULL ? do_alt_speller(temp) :
|
||||
|
@ -1871,11 +1857,9 @@ int do_spell(void)
|
|||
if (spell_msg != NULL) {
|
||||
statusbar(_("Spell checking failed: %s: %s"), spell_msg,
|
||||
strerror(errno));
|
||||
return 0;
|
||||
return;
|
||||
} else
|
||||
statusbar(_("Finished checking spelling"));
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif /* !DISABLE_SPELLER */
|
||||
|
||||
|
@ -2370,19 +2354,19 @@ int do_para_search(justbegend search_type, size_t *quote, size_t *par,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int do_para_begin(void)
|
||||
void do_para_begin(void)
|
||||
{
|
||||
return do_para_search(BEGIN, NULL, NULL, NULL, TRUE);
|
||||
do_para_search(BEGIN, NULL, NULL, NULL, TRUE);
|
||||
}
|
||||
|
||||
int do_para_end(void)
|
||||
void do_para_end(void)
|
||||
{
|
||||
return do_para_search(END, NULL, NULL, NULL, TRUE);
|
||||
do_para_search(END, NULL, NULL, NULL, TRUE);
|
||||
}
|
||||
|
||||
/* If full_justify is TRUE, justify the entire file. Otherwise, justify
|
||||
* the current paragraph. */
|
||||
int do_justify(int full_justify)
|
||||
void do_justify(int full_justify)
|
||||
{
|
||||
size_t quote_len;
|
||||
/* Length of the initial quotation of the paragraph we
|
||||
|
@ -2444,7 +2428,7 @@ int do_justify(int full_justify)
|
|||
break;
|
||||
} else {
|
||||
edit_refresh();
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2712,73 +2696,45 @@ int do_justify(int full_justify)
|
|||
/* Display the shortcut list with UnCut. */
|
||||
shortcut_init(FALSE);
|
||||
display_main_list();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int do_justify_void(void)
|
||||
void do_justify_void(void)
|
||||
{
|
||||
return do_justify(FALSE);
|
||||
do_justify(FALSE);
|
||||
}
|
||||
|
||||
int do_full_justify(void)
|
||||
void do_full_justify(void)
|
||||
{
|
||||
return do_justify(TRUE);
|
||||
do_justify(TRUE);
|
||||
}
|
||||
#endif /* !DISABLE_JUSTIFY */
|
||||
|
||||
int do_exit(void)
|
||||
void do_exit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!ISSET(MODIFIED)) {
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (!close_open_file()) {
|
||||
display_main_list();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
finish();
|
||||
}
|
||||
|
||||
if (ISSET(TEMP_OPT))
|
||||
if (!ISSET(MODIFIED))
|
||||
i = 0; /* Pretend the user chose not to save. */
|
||||
else if (ISSET(TEMP_OPT))
|
||||
i = 1;
|
||||
else
|
||||
i = do_yesno(FALSE, _("Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? "));
|
||||
i = do_yesno(FALSE,
|
||||
_("Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? "));
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_buffer(fileage);
|
||||
#endif
|
||||
|
||||
if (i == 1) {
|
||||
if (do_writeout(TRUE) > 0) {
|
||||
|
||||
if (i == 0 || (i == 1 && do_writeout(TRUE) > 0)) {
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (!close_open_file()) {
|
||||
display_main_list();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
/* Exit only if there are no more open buffers. */
|
||||
if (close_open_file() != 0)
|
||||
#endif
|
||||
finish();
|
||||
}
|
||||
} else if (i == 0) {
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (!close_open_file()) {
|
||||
display_main_list();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
finish();
|
||||
} else
|
||||
} else if (i != 1)
|
||||
statusbar(_("Cancelled"));
|
||||
|
||||
display_main_list();
|
||||
return 1;
|
||||
}
|
||||
|
||||
void signal_init(void)
|
||||
|
@ -3537,11 +3493,11 @@ int main(int argc, char *argv[])
|
|||
int old_multibuffer = ISSET(MULTIBUFFER);
|
||||
SET(MULTIBUFFER);
|
||||
for (optind++; optind < argc; optind++) {
|
||||
add_open_file(1);
|
||||
add_open_file(TRUE);
|
||||
new_file();
|
||||
filename = mallocstrcpy(filename, argv[optind]);
|
||||
open_file(filename, 0, 0);
|
||||
load_file(0);
|
||||
load_file(FALSE);
|
||||
}
|
||||
open_nextfile_void();
|
||||
if (!old_multibuffer)
|
||||
|
|
|
@ -179,7 +179,7 @@ typedef struct shortcut {
|
|||
int funcval; /* Function key we want bound. */
|
||||
int miscval; /* Other Meta key we want bound. */
|
||||
int viewok; /* Is this function legal in view mode? */
|
||||
int (*func) (void); /* Function to call when we catch this key. */
|
||||
void (*func)(void); /* Function to call when we catch this key. */
|
||||
const char *desc; /* Description, e.g. "Page Up". */
|
||||
#ifndef DISABLE_HELP
|
||||
const char *help; /* Help file entry text. */
|
||||
|
|
100
src/proto.h
100
src/proto.h
|
@ -152,8 +152,8 @@ void cutbuffer_reset(void);
|
|||
filestruct *get_cutbottom(void);
|
||||
void add_to_cutbuffer(filestruct *inptr, int allow_concat);
|
||||
void cut_marked_segment(void);
|
||||
int do_cut_text(void);
|
||||
int do_uncut_text(void);
|
||||
void do_cut_text(void);
|
||||
void do_uncut_text(void);
|
||||
|
||||
/* Public functions in files.c */
|
||||
void load_file(int update);
|
||||
|
@ -163,20 +163,20 @@ filestruct *read_line(char *buf, filestruct *prev, int *line1ins, size_t
|
|||
int read_file(FILE *f, const char *filename, int quiet);
|
||||
int open_file(const char *filename, int insert, int quiet);
|
||||
char *get_next_filename(const char *name);
|
||||
int do_insertfile(int loading_file);
|
||||
int do_insertfile_void(void);
|
||||
void do_insertfile(int loading_file);
|
||||
void do_insertfile_void(void);
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
openfilestruct *make_new_opennode(openfilestruct *prevnode);
|
||||
void splice_opennode(openfilestruct *begin, openfilestruct *newnode, openfilestruct *end);
|
||||
void unlink_opennode(const openfilestruct *fileptr);
|
||||
void delete_opennode(openfilestruct *fileptr);
|
||||
void free_openfilestruct(openfilestruct *src);
|
||||
int add_open_file(int update);
|
||||
int load_open_file(void);
|
||||
int open_prevfile(int closing_file);
|
||||
int open_prevfile_void(void);
|
||||
int open_nextfile(int closing_file);
|
||||
int open_nextfile_void(void);
|
||||
void add_open_file(int update);
|
||||
void load_open_file(void);
|
||||
void open_prevfile(int closing_file);
|
||||
void open_prevfile_void(void);
|
||||
void open_nextfile(int closing_file);
|
||||
void open_nextfile_void(void);
|
||||
int close_open_file(void);
|
||||
#endif
|
||||
#if !defined(DISABLE_SPELLER) || !defined(DISABLE_OPERATINGDIR)
|
||||
|
@ -198,7 +198,7 @@ int write_file(const char *name, int tmp, int append, int nonamechange);
|
|||
int write_marked(const char *name, int tmp, int append);
|
||||
#endif
|
||||
int do_writeout(int exiting);
|
||||
int do_writeout_void(void);
|
||||
void do_writeout_void(void);
|
||||
char *real_dir_from_tilde(const char *buf);
|
||||
#ifndef DISABLE_TABCOMP
|
||||
int append_slash_if_dir(char *buf, int *lastwastab, int *place);
|
||||
|
@ -223,7 +223,7 @@ void sc_init_one(shortcut **shortcutage, int key, const char *desc,
|
|||
#ifndef DISABLE_HELP
|
||||
const char *help,
|
||||
#endif
|
||||
int metaval, int funcval, int miscval, int view, int
|
||||
int metaval, int funcval, int miscval, int view, void
|
||||
(*func)(void));
|
||||
#ifndef NANO_SMALL
|
||||
void toggle_init_one(int val, const char *desc, int flag);
|
||||
|
@ -239,18 +239,18 @@ void thanks_for_all_the_fish(void);
|
|||
#endif
|
||||
|
||||
/* Public functions in move.c */
|
||||
int do_first_line(void);
|
||||
int do_last_line(void);
|
||||
int do_home(void);
|
||||
int do_end(void);
|
||||
int do_page_up(void);
|
||||
int do_page_down(void);
|
||||
int do_up(void);
|
||||
int do_down(void);
|
||||
int do_left(int allow_update);
|
||||
int do_left_void(void);
|
||||
int do_right(int allow_update);
|
||||
int do_right_void(void);
|
||||
void do_first_line(void);
|
||||
void do_last_line(void);
|
||||
void do_home(void);
|
||||
void do_end(void);
|
||||
void do_page_up(void);
|
||||
void do_page_down(void);
|
||||
void do_up(void);
|
||||
void do_down(void);
|
||||
void do_left(int allow_update);
|
||||
void do_left_void(void);
|
||||
void do_right(int allow_update);
|
||||
void do_right_void(void);
|
||||
|
||||
/* Public functions in nano.c */
|
||||
void finish(void);
|
||||
|
@ -280,7 +280,7 @@ void print1opt(const char *shortflag, const char *longflag,
|
|||
void usage(void);
|
||||
void version(void);
|
||||
int no_help(void);
|
||||
int nano_disabled_msg(void);
|
||||
void nano_disabled_msg(void);
|
||||
#ifndef NANO_SMALL
|
||||
RETSIGTYPE cancel_fork(int signal);
|
||||
int open_pipe(const char *command);
|
||||
|
@ -289,15 +289,15 @@ int open_pipe(const char *command);
|
|||
void do_mouse(void);
|
||||
#endif
|
||||
void do_char(char ch);
|
||||
int do_verbatim_input(void);
|
||||
int do_backspace(void);
|
||||
int do_delete(void);
|
||||
int do_tab(void);
|
||||
int do_enter(void);
|
||||
void do_verbatim_input(void);
|
||||
void do_backspace(void);
|
||||
void do_delete(void);
|
||||
void do_tab(void);
|
||||
void do_enter(void);
|
||||
#ifndef NANO_SMALL
|
||||
int do_next_word(void);
|
||||
int do_prev_word(void);
|
||||
int do_mark(void);
|
||||
void do_next_word(void);
|
||||
void do_prev_word(void);
|
||||
void do_mark(void);
|
||||
#endif
|
||||
#ifndef DISABLE_WRAPPING
|
||||
void wrap_reset(void);
|
||||
|
@ -307,7 +307,7 @@ int do_wrap(filestruct *inptr);
|
|||
int do_int_spell_fix(const char *word);
|
||||
const char *do_int_speller(char *tempfile_name);
|
||||
const char *do_alt_speller(char *tempfile_name);
|
||||
int do_spell(void);
|
||||
void do_spell(void);
|
||||
#endif
|
||||
#if !defined(DISABLE_WRAPPING) && !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
|
||||
size_t indent_length(const char *line);
|
||||
|
@ -334,13 +334,13 @@ int breakable(const char *line, int goal);
|
|||
int break_line(const char *line, int goal, int force);
|
||||
int do_para_search(justbegend search_type, size_t *quote, size_t *par,
|
||||
size_t *indent, int do_refresh);
|
||||
int do_para_begin(void);
|
||||
int do_para_end(void);
|
||||
int do_justify(int justify_all);
|
||||
int do_justify_void(void);
|
||||
int do_full_justify(void);
|
||||
void do_para_begin(void);
|
||||
void do_para_end(void);
|
||||
void do_justify(int full_justify);
|
||||
void do_justify_void(void);
|
||||
void do_full_justify(void);
|
||||
#endif /* !DISABLE_JUSTIFY */
|
||||
int do_exit(void);
|
||||
void do_exit(void);
|
||||
void signal_init(void);
|
||||
RETSIGTYPE handle_hupterm(int signal);
|
||||
RETSIGTYPE do_suspend(int signal);
|
||||
|
@ -391,9 +391,9 @@ int is_whole_word(int curr_pos, const char *datastr, const char
|
|||
*searchword);
|
||||
int findnextstr(int can_display_wrap, int wholeword, const filestruct
|
||||
*begin, size_t beginx, const char *needle, int no_sameline);
|
||||
int do_search(void);
|
||||
void do_search(void);
|
||||
#ifndef NANO_SMALL
|
||||
int do_research(void);
|
||||
void do_research(void);
|
||||
#endif
|
||||
void replace_abort(void);
|
||||
#ifdef HAVE_REGEX_H
|
||||
|
@ -402,13 +402,13 @@ int replace_regexp(char *string, int create_flag);
|
|||
char *replace_line(const char *needle);
|
||||
int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||
size_t *real_current_x, int wholewords);
|
||||
int do_replace(void);
|
||||
int do_gotoline(int line, int save_pos);
|
||||
int do_gotoline_void(void);
|
||||
void do_replace(void);
|
||||
void do_gotoline(int line, int save_pos);
|
||||
void do_gotoline_void(void);
|
||||
#if defined (ENABLE_MULTIBUFFER) || !defined (DISABLE_SPELLER)
|
||||
void do_gotopos(int line, int pos_x, int pos_y, int pos_placewewant);
|
||||
#endif
|
||||
int do_find_bracket(void);
|
||||
void do_find_bracket(void);
|
||||
#ifndef NANO_SMALL
|
||||
void history_init(void);
|
||||
historytype *find_node(historytype *h, char *s);
|
||||
|
@ -550,12 +550,12 @@ int statusq(int allowtabs, const shortcut *s, const char *def,
|
|||
#endif
|
||||
const char *msg, ...);
|
||||
int do_yesno(int all, const char *msg);
|
||||
int total_refresh(void);
|
||||
void total_refresh(void);
|
||||
void display_main_list(void);
|
||||
int do_cursorpos(int constant);
|
||||
int do_cursorpos_void(void);
|
||||
void do_cursorpos(int constant);
|
||||
void do_cursorpos_void(void);
|
||||
int line_len(const char *ptr);
|
||||
int do_help(void);
|
||||
void do_help(void);
|
||||
void do_replace_highlight(int highlight_flag, const char *word);
|
||||
#ifdef DEBUG
|
||||
void dump_buffer(const filestruct *inptr);
|
||||
|
|
47
src/search.c
47
src/search.c
|
@ -240,7 +240,7 @@ int search_init(int replacing)
|
|||
#endif
|
||||
i = (int)strtol(answer, &buf, 10); /* Just testing answer here. */
|
||||
if (!(errno == ERANGE || *answer == '\0' || *buf != '\0'))
|
||||
do_gotoline(-1, 0);
|
||||
do_gotoline(-1, FALSE);
|
||||
else
|
||||
do_gotoline_void();
|
||||
/* Fall through. */
|
||||
|
@ -359,7 +359,7 @@ int findnextstr(int can_display_wrap, int wholeword, const filestruct
|
|||
}
|
||||
|
||||
/* Search for a string. */
|
||||
int do_search(void)
|
||||
void do_search(void)
|
||||
{
|
||||
int old_pww = placewewant, i, fileptr_x = current_x, didfind;
|
||||
filestruct *fileptr = current;
|
||||
|
@ -380,7 +380,7 @@ int do_search(void)
|
|||
#endif
|
||||
|
||||
if (i != 0)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
/* If answer is now "", copy last_search into answer. */
|
||||
if (answer[0] == '\0')
|
||||
|
@ -422,13 +422,11 @@ int do_search(void)
|
|||
placewewant = xplustabs();
|
||||
edit_redraw(fileptr, old_pww);
|
||||
search_abort();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Search for the next string without prompting. */
|
||||
int do_research(void)
|
||||
void do_research(void)
|
||||
{
|
||||
int old_pww = placewewant, fileptr_x = current_x, didfind;
|
||||
filestruct *fileptr = current;
|
||||
|
@ -443,7 +441,7 @@ int do_research(void)
|
|||
#ifdef HAVE_REGEX_H
|
||||
/* Since answer is "", use last_search! */
|
||||
if (ISSET(USE_REGEXP) && regexp_init(last_search) == 0)
|
||||
return -1;
|
||||
return;
|
||||
#endif
|
||||
|
||||
search_last_line = FALSE;
|
||||
|
@ -475,8 +473,6 @@ int do_research(void)
|
|||
placewewant = xplustabs();
|
||||
edit_redraw(fileptr, old_pww);
|
||||
search_abort();
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -743,7 +739,7 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
|
|||
}
|
||||
|
||||
/* Replace a string. */
|
||||
int do_replace(void)
|
||||
void do_replace(void)
|
||||
{
|
||||
int i, numreplaced;
|
||||
filestruct *edittop_save, *begin;
|
||||
|
@ -752,23 +748,23 @@ int do_replace(void)
|
|||
if (ISSET(VIEW_MODE)) {
|
||||
print_view_warning();
|
||||
replace_abort();
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
i = search_init(1);
|
||||
if (i == -1) { /* Cancel, Go to Line, blank search
|
||||
* string, or regcomp() failed. */
|
||||
replace_abort();
|
||||
return 0;
|
||||
return;
|
||||
} else if (i == -2) { /* No Replace. */
|
||||
do_search();
|
||||
return 0;
|
||||
return;
|
||||
} else if (i == 1) /* Case Sensitive, Backwards, or Regexp
|
||||
* search toggle. */
|
||||
do_replace();
|
||||
|
||||
if (i != 0)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
/* If answer is not "", add answer to the search history list and
|
||||
* copy answer into last_search. */
|
||||
|
@ -804,7 +800,7 @@ int do_replace(void)
|
|||
statusbar(_("Replace Cancelled"));
|
||||
}
|
||||
replace_abort();
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
last_replace = mallocstrcpy(last_replace, answer);
|
||||
|
@ -828,10 +824,9 @@ int do_replace(void)
|
|||
numreplaced), numreplaced);
|
||||
|
||||
replace_abort();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_gotoline(int line, int save_pos)
|
||||
void do_gotoline(int line, int save_pos)
|
||||
{
|
||||
if (line <= 0) { /* Ask for it */
|
||||
char *ans = mallocstrcpy(NULL, answer);
|
||||
|
@ -848,7 +843,7 @@ int do_gotoline(int line, int save_pos)
|
|||
statusbar(_("Aborted"));
|
||||
if (st != 0) {
|
||||
display_main_list();
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
line = atoi(answer);
|
||||
|
@ -857,7 +852,7 @@ int do_gotoline(int line, int save_pos)
|
|||
if (line <= 0) {
|
||||
statusbar(_("Come on, be reasonable"));
|
||||
display_main_list();
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -866,18 +861,17 @@ int do_gotoline(int line, int save_pos)
|
|||
|
||||
current_x = 0;
|
||||
|
||||
/* If save_pos is nonzero, don't change the cursor position when
|
||||
/* If save_pos is TRUE, don't change the cursor position when
|
||||
* updating the edit window. */
|
||||
edit_update(current, save_pos ? NONE : CENTER);
|
||||
|
||||
placewewant = 0;
|
||||
display_main_list();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_gotoline_void(void)
|
||||
void do_gotoline_void(void)
|
||||
{
|
||||
return do_gotoline(0, 0);
|
||||
do_gotoline(0, FALSE);
|
||||
}
|
||||
|
||||
#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
|
||||
|
@ -886,7 +880,7 @@ void do_gotopos(int line, int pos_x, int pos_y, int pos_placewewant)
|
|||
/* since do_gotoline() resets the x-coordinate but not the
|
||||
y-coordinate, set the coordinates up this way */
|
||||
current_y = pos_y;
|
||||
do_gotoline(line, 1);
|
||||
do_gotoline(line, TRUE);
|
||||
|
||||
/* make sure that the x-coordinate is sane here */
|
||||
if (pos_x > strlen(current->data))
|
||||
|
@ -900,7 +894,7 @@ void do_gotopos(int line, int pos_x, int pos_y, int pos_placewewant)
|
|||
#endif
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
|
||||
int do_find_bracket(void)
|
||||
void do_find_bracket(void)
|
||||
{
|
||||
char ch_under_cursor, wanted_ch;
|
||||
const char *pos, *brackets = "([{<>}])";
|
||||
|
@ -913,7 +907,7 @@ int do_find_bracket(void)
|
|||
pos = strchr(brackets, ch_under_cursor);
|
||||
if (ch_under_cursor == '\0' || pos == NULL) {
|
||||
statusbar(_("Not a bracket"));
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
assert(strlen(brackets) % 2 == 0);
|
||||
|
@ -965,7 +959,6 @@ int do_find_bracket(void)
|
|||
|
||||
regexp_cleanup();
|
||||
flags = flagsave;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
16
src/winio.c
16
src/winio.c
|
@ -2924,7 +2924,7 @@ int do_yesno(int all, const char *msg)
|
|||
return ok;
|
||||
}
|
||||
|
||||
int total_refresh(void)
|
||||
void total_refresh(void)
|
||||
{
|
||||
clearok(topwin, TRUE);
|
||||
clearok(edit, TRUE);
|
||||
|
@ -2938,7 +2938,6 @@ int total_refresh(void)
|
|||
clearok(bottomwin, FALSE);
|
||||
edit_refresh();
|
||||
titlebar(NULL);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void display_main_list(void)
|
||||
|
@ -2953,7 +2952,7 @@ void display_main_list(void)
|
|||
* If constant is TRUE and DISABLE_CURPOS is set, we unset it and update
|
||||
* old_i and old_totsize. That way, we leave the current statusbar
|
||||
* alone, but next time we will display. */
|
||||
int do_cursorpos(int constant)
|
||||
void do_cursorpos(int constant)
|
||||
{
|
||||
const filestruct *fileptr;
|
||||
unsigned long i = 0;
|
||||
|
@ -2975,7 +2974,7 @@ int do_cursorpos(int constant)
|
|||
UNSET(DISABLE_CURPOS);
|
||||
old_i = i;
|
||||
old_totsize = totsize;
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* If constant is FALSE, display the position on the statusbar
|
||||
|
@ -3000,12 +2999,11 @@ int do_cursorpos(int constant)
|
|||
old_totsize = totsize;
|
||||
|
||||
reset_cursor();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int do_cursorpos_void(void)
|
||||
void do_cursorpos_void(void)
|
||||
{
|
||||
return do_cursorpos(FALSE);
|
||||
do_cursorpos(FALSE);
|
||||
}
|
||||
|
||||
/* Calculate the next line of help_text, starting at ptr. */
|
||||
|
@ -3036,7 +3034,7 @@ int line_len(const char *ptr)
|
|||
|
||||
#ifndef DISABLE_HELP
|
||||
/* Our dynamic, shortcut-list-compliant help function. */
|
||||
int do_help(void)
|
||||
void do_help(void)
|
||||
{
|
||||
int line = 0;
|
||||
/* The line number in help_text of the first displayed help line.
|
||||
|
@ -3160,8 +3158,6 @@ int do_help(void)
|
|||
* anymore. */
|
||||
free(help_text);
|
||||
help_text = NULL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif /* !DISABLE_HELP */
|
||||
|
||||
|
|
Loading…
Reference in New Issue