- 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
}
statusbar(_("Could not open file for writing: %s"),
strerror(errno));
+ fprintf(stderr, "1\n");
free(realname);
return -1;
}
if (fstat(fd, &st2) != 0) {
close(fd);
+ fprintf(stderr, "2\n");
return -1;
}
}
statusbar(_("Could not open file for writing: %s"),
strerror(errno));
+ fprintf(stderr, "3\n");
return -1;
}
}
if (size == -1) {
statusbar(_("Could not open file for writing: %s"),
strerror(errno));
+ fprintf(stderr, "4\n");
return -1;
} else {
#ifdef DEBUG
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;
}
}
if (close(fd) == -1) {
statusbar(_("Could not close %s: %s"), realname, strerror(errno));
unlink(buf);
+ fprintf(stderr, "7\n");
return -1;
}
if (errno != ENOENT) {
statusbar(_("Could not open %s for writing: %s"),
realname, strerror(errno));
+ fprintf(stderr, "8\n");
unlink(buf);
return -1;
}
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;
}
}
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)
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 */
&& (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)