From: Chris Allegretta Date: Fri, 28 Sep 2001 21:59:01 +0000 (+0000) Subject: Initialize totsize in files.c:new_file() and let do_gotopos keep current position... X-Git-Tag: v1.1.2~33 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=1b3381bee891fd39af3b2d6766c3da2e9b27a7fe;p=nano.git Initialize totsize in files.c:new_file() and let do_gotopos keep current position when invoking the alternate speller (DLR) git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@799 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 3ad8e038..afb6e216 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,10 +24,14 @@ CVS code - command is Meta-] (hope you dont mind since I already sold off Meta-O to the MacOS file code Ken...) Fixes to bracket_msg by DLR. + - Call do_gotopos from do_alt_spell() to keep position + consistent when invoking alt speller (DLR). - files.c: do_writeout() - Expanded strings to not use %s and ?: to determine write/append string to be nice to translators. + new_file() + - Initialize totsize (DLR). - nano.c: main() - Added vars oldcurrent and oldcurrent_x to check whether cursor diff --git a/config.h.in b/config.h.in index 7fcb8da2..02ba1537 100644 --- a/config.h.in +++ b/config.h.in @@ -1,4 +1,4 @@ -/* config.h.in. Generated automatically from configure.in by autoheader. */ +/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */ /* Define if using alloca.c. */ #undef C_ALLOCA diff --git a/files.c b/files.c index a2e5d08d..fdc752be 100644 --- a/files.c +++ b/files.c @@ -78,6 +78,7 @@ void new_file(void) editbot = fileage; current = fileage; totlines = 1; + totsize = 0; #ifdef ENABLE_MULTIBUFFER /* if there aren't any entries in open_files, create the entry for diff --git a/nano.c b/nano.c index fa6f9b8a..fb064d40 100644 --- a/nano.c +++ b/nano.c @@ -1526,7 +1526,7 @@ int do_int_speller(char *tempfile_name) /* External spell checking */ int do_alt_speller(char *file_name) { - int alt_spell_status, y_cur = current_y; + int alt_spell_status, x_cur = current_x, y_cur = current_y, pww_cur = placewewant; pid_t pid_spell; char *ptr; long lineno_cur = current->lineno; @@ -1579,10 +1579,9 @@ int do_alt_speller(char *file_name) global_init(1); open_file(file_name, 0, 1); - /* go back to the old line while keeping the same position, mark the - file as modified, and make sure that the titlebar is refreshed */ - current_y = y_cur; - do_gotoline(lineno_cur, 1); + /* go back to the old position, mark the file as modified, and make + sure that the titlebar is refreshed */ + do_gotopos(lineno_cur, x_cur, y_cur, pww_cur); set_modified(); clearok(topwin, FALSE); titlebar(NULL); diff --git a/proto.h b/proto.h index 955870eb..f972b7d6 100644 --- a/proto.h +++ b/proto.h @@ -113,7 +113,7 @@ int do_replace_loop(char *prevanswer, filestruct *begin, int *beginx, int wholewords, int *i); int do_find_bracket(void); -#ifdef ENABLE_MULTIBUFFER +#if defined (ENABLE_MULTIBUFFER) || !defined (DISABLE_SPELLER) void do_gotopos(long line, int pos_x, int pos_y, int pos_placewewant); #endif diff --git a/search.c b/search.c index 6fab9312..cdf21e68 100644 --- a/search.c +++ b/search.c @@ -806,7 +806,7 @@ int do_gotoline_void(void) return do_gotoline(0, 0); } -#ifdef ENABLE_MULTIBUFFER +#if (defined ENABLE_MULTIBUFFER || !defined DISABLE_SPELLER) void do_gotopos(long line, int pos_x, int pos_y, int pos_placewewant) {