Commit 4dfaf93b authored by Rocco Corsi's avatar Rocco Corsi
Browse files

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
No related merge requests found
Showing with 27 additions and 38 deletions
+27 -38
...@@ -14,6 +14,8 @@ Cvs code - ...@@ -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 - ...@@ -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
......
...@@ -1393,6 +1393,7 @@ int do_alt_speller(char *file_name) ...@@ -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) ...@@ -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;
......
...@@ -664,34 +664,22 @@ void goto_abort(void) ...@@ -664,34 +664,22 @@ 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 (line <= 0) { /* Ask for it */
if (defline > 0) /* We already know what line we want to go to */ long j = 0;
line = defline;
else { /* Ask for it */
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();
goto_abort();
return 0;
}
if (!strcmp(answer, "$")) {
current = filebot;
current_x = 0;
edit_update(current, CENTER);
goto_abort();
return 1;
} }
line = atoi(answer); line = atoi(answer);
}
/* Bounds check */ /* Bounds check */
if (line <= 0) { if (line <= 0) {
...@@ -699,20 +687,13 @@ int do_gotoline(long defline) ...@@ -699,20 +687,13 @@ int do_gotoline(long defline)
goto_abort(); goto_abort();
return 0; return 0;
} }
if (line > totlines) { }
statusbar(_("Only %d lines available, skipping to last line"),
filebot->lineno); for (current = fileage; ((current->next != NULL) && (i < line)); i++)
current = filebot; current = current->next;
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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment