Commit 8f1afee8 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

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
parent b00f7e3c
Showing with 29 additions and 15 deletions
+29 -15
...@@ -84,6 +84,10 @@ CVS code - ...@@ -84,6 +84,10 @@ CVS code -
allow_pending_sigwinch() allow_pending_sigwinch()
- Simplify by using the "?" operator instead of an if clause. - Simplify by using the "?" operator instead of an if clause.
(DLR) (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: - nano.h:
- Since we only use vsnprintf() now, remove the #ifdef block for - Since we only use vsnprintf() now, remove the #ifdef block for
HAVE_SNPRINTF. (DLR) HAVE_SNPRINTF. (DLR)
...@@ -103,6 +107,9 @@ CVS code - ...@@ -103,6 +107,9 @@ CVS code -
- Blank out last_replace properly again just before displaying - Blank out last_replace properly again just before displaying
the "Replace" prompt. (DLR, found by Mike Frysinger) the "Replace" prompt. (DLR, found by Mike Frysinger)
- Remove unnecessary renumber(). (DLR) - Remove unnecessary renumber(). (DLR)
do_gotolinecolumn()
- Add parameter allow_update to control whether the screen is
updated after moving. (DLR)
- winio.c: - winio.c:
edit_scroll(), edit_redraw(), edit_refresh() edit_scroll(), edit_redraw(), edit_refresh()
- Clean up and simplify. (DLR) - Clean up and simplify. (DLR)
......
...@@ -161,6 +161,8 @@ void color_update(void) ...@@ -161,6 +161,8 @@ void color_update(void)
REG_EXTENDED | (tmpcolor->icase ? REG_ICASE : 0)); REG_EXTENDED | (tmpcolor->icase ? REG_ICASE : 0));
} }
} }
color_init();
} }
#endif /* ENABLE_COLOR */ #endif /* ENABLE_COLOR */
...@@ -1586,10 +1586,8 @@ int write_file(const char *name, FILE *f_open, bool tmp, int append, ...@@ -1586,10 +1586,8 @@ int write_file(const char *name, FILE *f_open, bool tmp, int append,
realname); realname);
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
/* We might have changed the filename, so update the colors /* We might have changed the filename, so update the colors
* to account for it, and make sure we're using the updated * to account for it. */
* colors, if applicable. */
color_update(); color_update();
color_init();
/* If color syntaxes are available and turned on, we need to /* If color syntaxes are available and turned on, we need to
* call edit_refresh(). */ * call edit_refresh(). */
......
...@@ -4676,7 +4676,8 @@ int main(int argc, char **argv) ...@@ -4676,7 +4676,8 @@ int main(int argc, char **argv)
open_buffer(argv[i]); open_buffer(argv[i]);
if (iline > 1 || icol > 1) { if (iline > 1 || icol > 1) {
do_gotolinecolumn(iline, icol, FALSE, FALSE, FALSE); do_gotolinecolumn(iline, icol, FALSE, FALSE, FALSE,
FALSE);
iline = 1; iline = 1;
icol = 1; icol = 1;
} }
...@@ -4710,7 +4711,8 @@ int main(int argc, char **argv) ...@@ -4710,7 +4711,8 @@ int main(int argc, char **argv)
#endif #endif
if (startline > 1 || startcol > 1) if (startline > 1 || startcol > 1)
do_gotolinecolumn(startline, startcol, FALSE, FALSE, FALSE); do_gotolinecolumn(startline, startcol, FALSE, FALSE, FALSE,
FALSE);
display_main_list(); display_main_list();
......
...@@ -503,7 +503,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct ...@@ -503,7 +503,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
*canceled); *canceled);
void do_replace(void); void do_replace(void);
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, 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); void do_gotolinecolumn_void(void);
#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER) #if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t
......
...@@ -244,7 +244,8 @@ int search_init(bool replacing, bool use_answer) ...@@ -244,7 +244,8 @@ int search_init(bool replacing, bool use_answer)
return -2; /* Call the opposite search function. */ return -2; /* Call the opposite search function. */
case NANO_TOGOTOLINE_KEY: case NANO_TOGOTOLINE_KEY:
do_gotolinecolumn(openfile->current->lineno, 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 /* Put answer up on the statusbar and
* fall through. */ * fall through. */
default: default:
...@@ -968,12 +969,15 @@ void do_replace(void) ...@@ -968,12 +969,15 @@ void do_replace(void)
/* Go to the specified line and column, or ask for them if interactive /* 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. * 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, 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); char *ans = mallocstrcpy(NULL, answer);
/* Ask for it. */
int i = statusq(FALSE, gotoline_list, use_answer ? ans : "", int i = statusq(FALSE, gotoline_list, use_answer ? ans : "",
#ifndef NANO_SMALL #ifndef NANO_SMALL
NULL, NULL,
...@@ -1022,9 +1026,10 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, ...@@ -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->current_x = actual_x(openfile->current->data, column - 1);
openfile->placewewant = column - 1; openfile->placewewant = column - 1;
/* If save_pos is TRUE, don't change the cursor position when /* If allow_update is TRUE, update the edit window. If save_pos is
* updating the edit window. */ * TRUE, don't change the cursor position when doing it. */
edit_update(save_pos ? NONE : CENTER); if (allow_update)
edit_update(save_pos ? NONE : CENTER);
display_main_list(); display_main_list();
} }
...@@ -1032,7 +1037,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, ...@@ -1032,7 +1037,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
void do_gotolinecolumn_void(void) void do_gotolinecolumn_void(void)
{ {
do_gotolinecolumn(openfile->current->lineno, 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) #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 ...@@ -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 /* Since do_gotolinecolumn() resets the x-coordinate but not the
* y-coordinate, set the coordinates up this way. */ * y-coordinate, set the coordinates up this way. */
openfile->current_y = pos_y; 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. */ /* Set the rest of the coordinates up. */
openfile->placewewant = pos_pww; openfile->placewewant = pos_pww;
......
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