fix color breakage; also, in main(), when opening files with

"+LINE,COLUMN" arguments on the command line, don't update the screen
when moving to their specified lines and columns


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2873 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-07-16 07:06:36 +00:00
parent b00f7e3c6f
commit 8f1afee813
6 changed files with 29 additions and 15 deletions

View File

@ -84,6 +84,10 @@ CVS code -
allow_pending_sigwinch()
- Simplify by using the "?" operator instead of an if clause.
(DLR)
main()
- When opening files with "+LINE,COLUMN" arguments on the
command line, don't update the screen when moving to their
specified lines and columns. (DLR)
- nano.h:
- Since we only use vsnprintf() now, remove the #ifdef block for
HAVE_SNPRINTF. (DLR)
@ -103,6 +107,9 @@ CVS code -
- Blank out last_replace properly again just before displaying
the "Replace" prompt. (DLR, found by Mike Frysinger)
- Remove unnecessary renumber(). (DLR)
do_gotolinecolumn()
- Add parameter allow_update to control whether the screen is
updated after moving. (DLR)
- winio.c:
edit_scroll(), edit_redraw(), edit_refresh()
- Clean up and simplify. (DLR)

View File

@ -161,6 +161,8 @@ void color_update(void)
REG_EXTENDED | (tmpcolor->icase ? REG_ICASE : 0));
}
}
color_init();
}
#endif /* ENABLE_COLOR */

View File

@ -1586,10 +1586,8 @@ int write_file(const char *name, FILE *f_open, bool tmp, int append,
realname);
#ifdef ENABLE_COLOR
/* We might have changed the filename, so update the colors
* to account for it, and make sure we're using the updated
* colors, if applicable. */
* to account for it. */
color_update();
color_init();
/* If color syntaxes are available and turned on, we need to
* call edit_refresh(). */

View File

@ -4676,7 +4676,8 @@ int main(int argc, char **argv)
open_buffer(argv[i]);
if (iline > 1 || icol > 1) {
do_gotolinecolumn(iline, icol, FALSE, FALSE, FALSE);
do_gotolinecolumn(iline, icol, FALSE, FALSE, FALSE,
FALSE);
iline = 1;
icol = 1;
}
@ -4710,7 +4711,8 @@ int main(int argc, char **argv)
#endif
if (startline > 1 || startcol > 1)
do_gotolinecolumn(startline, startcol, FALSE, FALSE, FALSE);
do_gotolinecolumn(startline, startcol, FALSE, FALSE, FALSE,
FALSE);
display_main_list();

View File

@ -503,7 +503,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
*canceled);
void do_replace(void);
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
bool interactive, bool save_pos);
bool interactive, bool save_pos, bool allow_update);
void do_gotolinecolumn_void(void);
#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t

View File

@ -244,7 +244,8 @@ int search_init(bool replacing, bool use_answer)
return -2; /* Call the opposite search function. */
case NANO_TOGOTOLINE_KEY:
do_gotolinecolumn(openfile->current->lineno,
openfile->placewewant + 1, TRUE, TRUE, FALSE);
openfile->placewewant + 1, TRUE, TRUE, FALSE,
TRUE);
/* Put answer up on the statusbar and
* fall through. */
default:
@ -968,12 +969,15 @@ void do_replace(void)
/* Go to the specified line and column, or ask for them if interactive
* is TRUE. Save the x-coordinate and y-coordinate if save_pos is TRUE.
* Note that both the line and column numbers should be one-based. */
* Update the screen afterwards if allow_update is TRUE. Note that both
* the line and column numbers should be one-based. */
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
bool interactive, bool save_pos)
bool interactive, bool save_pos, bool allow_update)
{
if (interactive) { /* Ask for it. */
if (interactive) {
char *ans = mallocstrcpy(NULL, answer);
/* Ask for it. */
int i = statusq(FALSE, gotoline_list, use_answer ? ans : "",
#ifndef NANO_SMALL
NULL,
@ -1022,9 +1026,10 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
openfile->current_x = actual_x(openfile->current->data, column - 1);
openfile->placewewant = column - 1;
/* If save_pos is TRUE, don't change the cursor position when
* updating the edit window. */
edit_update(save_pos ? NONE : CENTER);
/* If allow_update is TRUE, update the edit window. If save_pos is
* TRUE, don't change the cursor position when doing it. */
if (allow_update)
edit_update(save_pos ? NONE : CENTER);
display_main_list();
}
@ -1032,7 +1037,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
void do_gotolinecolumn_void(void)
{
do_gotolinecolumn(openfile->current->lineno,
openfile->placewewant + 1, FALSE, TRUE, FALSE);
openfile->placewewant + 1, FALSE, TRUE, FALSE, TRUE);
}
#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
@ -1042,7 +1047,7 @@ void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t
/* Since do_gotolinecolumn() resets the x-coordinate but not the
* y-coordinate, set the coordinates up this way. */
openfile->current_y = pos_y;
do_gotolinecolumn(line, pos_x + 1, FALSE, FALSE, TRUE);
do_gotolinecolumn(line, pos_x + 1, FALSE, FALSE, TRUE, TRUE);
/* Set the rest of the coordinates up. */
openfile->placewewant = pos_pww;