diff --git a/ChangeLog b/ChangeLog index 0549898ecb034d768c9152e4537af72fde7c613f..31f73764daf32cfe56278ae04968005d2ba2d41e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,8 @@ Cvs code - function ncalloc(), will have to go through source code later and change the aproproate calls which used nmalloc for lack of 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: - New option, --enable-nanorc which currently does nothing but sets a define. Will do more later... @@ -24,12 +26,17 @@ Cvs code - - global.c: - Updated some of the lists for the "Goto Directory" code (Rocco) - nano.c: + do_alt_speller() + - Reposition cursor on same line as before ^T was called (Rocco) main() - Code to silently process "-g" and "-j" (Rocco) - nano.h: - Updated the BROWSER_LIST_LEN for the "Goto Directory" code (Rocco) - proto.h: - 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 diff --git a/nano.c b/nano.c index 86ce57b8e670a8f3f9c0c59934fd345819071e79..054775f71ae05b47eccbd0d4556627b502a68ce9 100644 --- a/nano.c +++ b/nano.c @@ -1393,6 +1393,7 @@ int do_alt_speller(char *file_name) int alt_spell_status; pid_t pid_spell; char *ptr; + long lineno_cur = current->lineno; static int arglen = 3; static char **spellargs = (char **) NULL; @@ -1441,8 +1442,8 @@ int do_alt_speller(char *file_name) free_filestruct(fileage); global_init(); open_file(file_name, 0, 1); - edit_update(fileage, CENTER); - display_main_list(); + + do_gotoline(lineno_cur); set_modified(); return TRUE; diff --git a/search.c b/search.c index 97f1ece763d3770f8fb22a7325b6428d638573d2..715a32bbb018479d52cf819de2c92b2b46bae382 100644 --- a/search.c +++ b/search.c @@ -664,55 +664,36 @@ void goto_abort(void) display_main_list(); } -int do_gotoline(long defline) +int do_gotoline(long line) { - long line, i = 1, j = 0; - filestruct *fileptr; + long i = 1; + + if (line <= 0) { /* Ask for it */ - if (defline > 0) /* We already know what line we want to go to */ - line = defline; - else { /* Ask for it */ + long j = 0; j = statusq(0, goto_list, GOTO_LIST_LEN, "", _("Enter line number")); - if (j == -1) { + if (j != 0) { statusbar(_("Aborted")); goto_abort(); 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); + + line = atoi(answer); + + /* Bounds check */ + if (line <= 0) { + statusbar(_("Come on, be reasonable")); goto_abort(); - return 1; + return 0; } - line = atoi(answer); } - /* Bounds check */ - if (line <= 0) { - 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; + for (current = fileage; ((current->next != NULL) && (i < line)); i++) + current = current->next; - current = fileptr; - current_x = 0; - edit_update(current, CENTER); - } + current_x = 0; + edit_update(current, CENTER); goto_abort(); return 1;