mirror of git://git.sv.gnu.org/nano.git
Rocco fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@385 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
928a7f535c
commit
fb62f73a9a
|
@ -10,6 +10,11 @@ CVS code -
|
|||
- winio.c:
|
||||
edit_add()
|
||||
- Off by one display error (fix by Rocco Corsi).
|
||||
do_replace_highlight()
|
||||
- New code to handle being past COLS (Roco Corsi).
|
||||
- Moved from search.c, as it's definitely a winio function now =)
|
||||
update_line()
|
||||
- More '$' display fixes (Rocco Corsi).
|
||||
|
||||
nano 0.9.22 - 12/02/2000
|
||||
- General
|
||||
|
|
10
files.c
10
files.c
|
@ -352,6 +352,7 @@ int write_file(char *name, int tmp)
|
|||
}
|
||||
statusbar(_("Could not open file for writing: %s"),
|
||||
strerror(errno));
|
||||
fprintf(stderr, "1\n");
|
||||
free(realname);
|
||||
return -1;
|
||||
}
|
||||
|
@ -361,6 +362,7 @@ int write_file(char *name, int tmp)
|
|||
|
||||
if (fstat(fd, &st2) != 0) {
|
||||
close(fd);
|
||||
fprintf(stderr, "2\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -382,6 +384,7 @@ int write_file(char *name, int tmp)
|
|||
}
|
||||
statusbar(_("Could not open file for writing: %s"),
|
||||
strerror(errno));
|
||||
fprintf(stderr, "3\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -396,6 +399,7 @@ int write_file(char *name, int tmp)
|
|||
if (size == -1) {
|
||||
statusbar(_("Could not open file for writing: %s"),
|
||||
strerror(errno));
|
||||
fprintf(stderr, "4\n");
|
||||
return -1;
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
|
@ -413,12 +417,14 @@ int write_file(char *name, int tmp)
|
|||
if (size == -1) {
|
||||
statusbar(_("Could not open file for writing: %s"),
|
||||
strerror(errno));
|
||||
fprintf(stderr, "5\n");
|
||||
return -1;
|
||||
} else if (size > 0) {
|
||||
size = write(fd, "\n", 1);
|
||||
if (size == -1) {
|
||||
statusbar(_("Could not open file for writing: %s"),
|
||||
strerror(errno));
|
||||
fprintf(stderr, "6\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -428,6 +434,7 @@ int write_file(char *name, int tmp)
|
|||
if (close(fd) == -1) {
|
||||
statusbar(_("Could not close %s: %s"), realname, strerror(errno));
|
||||
unlink(buf);
|
||||
fprintf(stderr, "7\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -449,6 +456,7 @@ int write_file(char *name, int tmp)
|
|||
if (errno != ENOENT) {
|
||||
statusbar(_("Could not open %s for writing: %s"),
|
||||
realname, strerror(errno));
|
||||
fprintf(stderr, "8\n");
|
||||
unlink(buf);
|
||||
return -1;
|
||||
}
|
||||
|
@ -462,11 +470,13 @@ int write_file(char *name, int tmp)
|
|||
statusbar(_("Could not open %s for writing: %s"),
|
||||
name, strerror(errno));
|
||||
unlink(buf);
|
||||
fprintf(stderr, "9\n");
|
||||
return -1;
|
||||
} else if (rename(buf, realname) == -1) { /* Try a rename?? */
|
||||
statusbar(_("Could not open %s for writing: %s"),
|
||||
realname, strerror(errno));
|
||||
unlink(buf);
|
||||
fprintf(stderr, "10\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
21
search.c
21
search.c
|
@ -468,27 +468,6 @@ char *replace_line(void)
|
|||
return copy;
|
||||
}
|
||||
|
||||
/* highlight the current word being replaced or spell checked */
|
||||
void do_replace_highlight(int highlight_flag, char *word)
|
||||
{
|
||||
char *highlight_word = NULL;
|
||||
|
||||
highlight_word = mallocstrcpy(highlight_word, ¤t->data[current_x]);
|
||||
highlight_word[strlen(word)] = '\0';
|
||||
|
||||
reset_cursor();
|
||||
|
||||
if (highlight_flag)
|
||||
wattron(edit, A_REVERSE);
|
||||
|
||||
waddstr(edit, highlight_word);
|
||||
|
||||
if (highlight_flag)
|
||||
wattroff(edit, A_REVERSE);
|
||||
|
||||
free(highlight_word);
|
||||
}
|
||||
|
||||
/* step through each replace word and prompt user before replacing word */
|
||||
int do_replace_loop(char *prevanswer, filestruct *begin, int *beginx,
|
||||
int wholewords, int *i)
|
||||
|
|
36
winio.c
36
winio.c
|
@ -832,7 +832,7 @@ void update_line(filestruct * fileptr, int index)
|
|||
edit_add(filetmp, line, col, virt_cur_x, virt_mark_beginx, page);
|
||||
mvwaddch(edit, line, 0, '$');
|
||||
|
||||
if (strlenpt(fileptr->data) > get_page_end_virtual(page))
|
||||
if (strlenpt(fileptr->data) > get_page_end_virtual(page) + 1)
|
||||
mvwaddch(edit, line, COLS - 1, '$');
|
||||
} else {
|
||||
/* It's not the current line means that it's at x=0 and page=1 */
|
||||
|
@ -1331,6 +1331,40 @@ void fix_editbot(void)
|
|||
&& (editbot != filebot); i++, editbot = editbot->next);
|
||||
}
|
||||
|
||||
/* highlight the current word being replaced or spell checked */
|
||||
void do_replace_highlight(int highlight_flag, char *word)
|
||||
{
|
||||
char *highlight_word = NULL;
|
||||
int x, y;
|
||||
|
||||
highlight_word = mallocstrcpy(highlight_word, ¤t->data[current_x]);
|
||||
highlight_word[strlen(word)] = '\0';
|
||||
|
||||
/* adjust output when word extends beyond screen*/
|
||||
|
||||
x = xplustabs();
|
||||
y = get_page_end_virtual(get_page_from_virtual(x)) + 1;
|
||||
|
||||
if ((COLS - (y - x) + strlen(word)) > COLS) {
|
||||
highlight_word[y - x - 1] = '$';
|
||||
highlight_word[y - x] = '\0';
|
||||
}
|
||||
|
||||
/* OK display the output */
|
||||
|
||||
reset_cursor();
|
||||
|
||||
if (highlight_flag)
|
||||
wattron(edit, A_REVERSE);
|
||||
|
||||
waddstr(edit, highlight_word);
|
||||
|
||||
if (highlight_flag)
|
||||
wattroff(edit, A_REVERSE);
|
||||
|
||||
free(highlight_word);
|
||||
}
|
||||
|
||||
#ifdef NANO_EXTRA
|
||||
#define CREDIT_LEN 45
|
||||
void do_credits(void)
|
||||
|
|
Loading…
Reference in New Issue