Alt Speller returns to same line & do_gotoline optimizations
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@609 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
7a50009b1f
Коммит
4dfaf93bcd
@ -14,6 +14,8 @@ Cvs code -
|
|||||||
function ncalloc(), will have to go through source code later
|
function ncalloc(), will have to go through source code later
|
||||||
and change the aproproate calls which used nmalloc for lack of
|
and change the aproproate calls which used nmalloc for lack of
|
||||||
an apropriate calloc function *** FIXME ***
|
an apropriate calloc function *** FIXME ***
|
||||||
|
- After "Alternate" spell checker is called, cursor is repositioned on
|
||||||
|
the same line as before ^T was called.
|
||||||
- configure.in:
|
- configure.in:
|
||||||
- New option, --enable-nanorc which currently does nothing but
|
- New option, --enable-nanorc which currently does nothing but
|
||||||
sets a define. Will do more later...
|
sets a define. Will do more later...
|
||||||
@ -24,12 +26,17 @@ Cvs code -
|
|||||||
- global.c:
|
- global.c:
|
||||||
- Updated some of the lists for the "Goto Directory" code (Rocco)
|
- Updated some of the lists for the "Goto Directory" code (Rocco)
|
||||||
- nano.c:
|
- nano.c:
|
||||||
|
do_alt_speller()
|
||||||
|
- Reposition cursor on same line as before ^T was called (Rocco)
|
||||||
main()
|
main()
|
||||||
- Code to silently process "-g" and "-j" (Rocco)
|
- Code to silently process "-g" and "-j" (Rocco)
|
||||||
- nano.h:
|
- nano.h:
|
||||||
- Updated the BROWSER_LIST_LEN for the "Goto Directory" code (Rocco)
|
- Updated the BROWSER_LIST_LEN for the "Goto Directory" code (Rocco)
|
||||||
- proto.h:
|
- proto.h:
|
||||||
- New shortcut list added: gotodir_list (Rocco).
|
- New shortcut list added: gotodir_list (Rocco).
|
||||||
|
- search.c:
|
||||||
|
do_gotoline()
|
||||||
|
- Optimizations, remove "$" goes-to-last-line, less messages (Rocco)
|
||||||
|
|
||||||
nano 1.1 tree forked here 04/07/2001
|
nano 1.1 tree forked here 04/07/2001
|
||||||
|
|
||||||
|
5
nano.c
5
nano.c
@ -1393,6 +1393,7 @@ int do_alt_speller(char *file_name)
|
|||||||
int alt_spell_status;
|
int alt_spell_status;
|
||||||
pid_t pid_spell;
|
pid_t pid_spell;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
long lineno_cur = current->lineno;
|
||||||
static int arglen = 3;
|
static int arglen = 3;
|
||||||
static char **spellargs = (char **) NULL;
|
static char **spellargs = (char **) NULL;
|
||||||
|
|
||||||
@ -1441,8 +1442,8 @@ int do_alt_speller(char *file_name)
|
|||||||
free_filestruct(fileage);
|
free_filestruct(fileage);
|
||||||
global_init();
|
global_init();
|
||||||
open_file(file_name, 0, 1);
|
open_file(file_name, 0, 1);
|
||||||
edit_update(fileage, CENTER);
|
|
||||||
display_main_list();
|
do_gotoline(lineno_cur);
|
||||||
set_modified();
|
set_modified();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
53
search.c
53
search.c
@ -664,55 +664,36 @@ void goto_abort(void)
|
|||||||
display_main_list();
|
display_main_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
int do_gotoline(long defline)
|
int do_gotoline(long line)
|
||||||
{
|
{
|
||||||
long line, i = 1, j = 0;
|
long i = 1;
|
||||||
filestruct *fileptr;
|
|
||||||
|
|
||||||
if (defline > 0) /* We already know what line we want to go to */
|
if (line <= 0) { /* Ask for it */
|
||||||
line = defline;
|
|
||||||
else { /* Ask for it */
|
long j = 0;
|
||||||
|
|
||||||
j = statusq(0, goto_list, GOTO_LIST_LEN, "", _("Enter line number"));
|
j = statusq(0, goto_list, GOTO_LIST_LEN, "", _("Enter line number"));
|
||||||
if (j == -1) {
|
if (j != 0) {
|
||||||
statusbar(_("Aborted"));
|
statusbar(_("Aborted"));
|
||||||
goto_abort();
|
goto_abort();
|
||||||
return 0;
|
return 0;
|
||||||
} else if (j != 0) {
|
}
|
||||||
do_early_abort();
|
|
||||||
|
line = atoi(answer);
|
||||||
|
|
||||||
|
/* Bounds check */
|
||||||
|
if (line <= 0) {
|
||||||
|
statusbar(_("Come on, be reasonable"));
|
||||||
goto_abort();
|
goto_abort();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!strcmp(answer, "$")) {
|
|
||||||
current = filebot;
|
|
||||||
current_x = 0;
|
|
||||||
edit_update(current, CENTER);
|
|
||||||
goto_abort();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
line = atoi(answer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bounds check */
|
for (current = fileage; ((current->next != NULL) && (i < line)); i++)
|
||||||
if (line <= 0) {
|
current = current->next;
|
||||||
statusbar(_("Come on, be reasonable"));
|
|
||||||
goto_abort();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (line > totlines) {
|
|
||||||
statusbar(_("Only %d lines available, skipping to last line"),
|
|
||||||
filebot->lineno);
|
|
||||||
current = filebot;
|
|
||||||
current_x = 0;
|
|
||||||
edit_update(current, CENTER);
|
|
||||||
} else {
|
|
||||||
for (fileptr = fileage; fileptr != NULL && i < line; i++)
|
|
||||||
fileptr = fileptr->next;
|
|
||||||
|
|
||||||
current = fileptr;
|
current_x = 0;
|
||||||
current_x = 0;
|
edit_update(current, CENTER);
|
||||||
edit_update(current, CENTER);
|
|
||||||
}
|
|
||||||
|
|
||||||
goto_abort();
|
goto_abort();
|
||||||
return 1;
|
return 1;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user