From: Rocco Corsi Date: Fri, 20 Apr 2001 01:59:55 +0000 (+0000) Subject: Alt Speller returns to same line & do_gotoline optimizations X-Git-Tag: v1.1.0~79 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=4dfaf93bcd9ce859114b55d0772d94bd9575dc3d;p=nano.git 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 --- diff --git a/ChangeLog b/ChangeLog index 0549898e..31f73764 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 86ce57b8..054775f7 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 97f1ece7..715a32bb 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;