nanoget_repaint changes, do_writeout fix with var length strings

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@259 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2000-11-02 14:53:46 +00:00
parent f5deac3d0f
commit 92d2bab3ef
4 changed files with 30 additions and 26 deletions

View File

@ -14,7 +14,9 @@ CVS Code -
*** Note that backspace key makes input be off by one when entring
*** a string > COLS in length. This must be fixed before a new release
- files.c:
do_writeout()
- Change strcpy to answer to mallocstrcpy.
- global.c
- New global replace_list_2, for 2nd half of the replace dialog
("Replace with:"), has fewer options than first half because

View File

@ -444,7 +444,7 @@ int do_writeout(int exiting)
{
int i = 0;
strncpy(answer, filename, 132);
answer = mallocstrcpy(answer, filename);
if ((exiting) && (ISSET(TEMP_OPT))) {
if (filename[0]) {
@ -469,7 +469,7 @@ int do_writeout(int exiting)
#ifdef DEBUG
fprintf(stderr, _("filename is %s"), answer);
#endif
if (strncmp(answer, filename, 132)) {
if (strcmp(answer, filename)) {
struct stat st;
if (!stat(answer, &st)) {
i = do_yesno(0, 0, _("File exists, OVERWRITE ?"));

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2000-11-02 00:10-0500\n"
"POT-Creation-Date: 2000-11-02 09:51-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -380,7 +380,7 @@ msgid "Case Sens"
msgstr ""
#: global.c:344 global.c:364 global.c:375 global.c:385 global.c:401
#: global.c:405 global.c:411 winio.c:981
#: global.c:405 global.c:411 winio.c:983
msgid "Cancel"
msgstr ""
@ -814,67 +814,67 @@ msgstr ""
msgid "actual_x_from_start for xplus=%d returned %d\n"
msgstr ""
#: winio.c:398
#: winio.c:399
#, c-format
msgid "input '%c' (%d)\n"
msgstr ""
#: winio.c:434
#: winio.c:436
msgid "New Buffer"
msgstr ""
#: winio.c:437
#: winio.c:439
msgid " File: ..."
msgstr ""
#: winio.c:445
#: winio.c:447
msgid "Modified"
msgstr ""
#: winio.c:897
#: winio.c:899
#, c-format
msgid "Moved to (%d, %d) in edit buffer\n"
msgstr ""
#: winio.c:908
#: winio.c:910
#, c-format
msgid "current->data = \"%s\"\n"
msgstr ""
#: winio.c:951
#: winio.c:953
#, c-format
msgid "I got \"%s\"\n"
msgstr ""
#: winio.c:976
#: winio.c:978
msgid "Yes"
msgstr ""
#: winio.c:978
#: winio.c:980
msgid "All"
msgstr ""
#: winio.c:980
#: winio.c:982
msgid "No"
msgstr ""
#: winio.c:1117
#: winio.c:1119
#, c-format
msgid "do_cursorpos: linepct = %f, bytepct = %f\n"
msgstr ""
#: winio.c:1121
#: winio.c:1123
msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
msgstr ""
#: winio.c:1249
#: winio.c:1251
msgid "Dumping file buffer to stderr...\n"
msgstr ""
#: winio.c:1251
#: winio.c:1253
msgid "Dumping cutbuffer to stderr...\n"
msgstr ""
#: winio.c:1253
#: winio.c:1255
msgid "Dumping a buffer to stderr...\n"
msgstr ""

14
winio.c
View File

@ -222,17 +222,17 @@ void check_statblank(void)
void nanoget_repaint(char *buf, char *inputbuf, int x)
{
blank_statusbar();
if (x <= COLS) {
if (x <= COLS - 1) {
mvwaddstr(bottomwin, 0, 0, buf);
waddnstr(bottomwin, inputbuf, COLS - strlen(buf));
waddnstr(bottomwin, inputbuf, (COLS - 1) - strlen(buf));
} else if (x > COLS && x <= COLS * 2)
mvwaddnstr(bottomwin, 0, 0, &inputbuf[COLS - strlen(buf)], COLS);
} else if (x > COLS - 1 && x <= (COLS - 1) * 2)
mvwaddnstr(bottomwin, 0, 0, &inputbuf[(COLS - 1) - strlen(buf)], COLS);
else
mvwaddnstr(bottomwin, 0, 0, &inputbuf[COLS * (x / COLS) -
mvwaddnstr(bottomwin, 0, 0, &inputbuf[COLS * (x / (COLS - 1)) -
strlen(buf)], COLS);
wmove(bottomwin, 0, (x % COLS));
wmove(bottomwin, 0, (x % (COLS - 1)));
}
@ -259,6 +259,7 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
for (j = 0; j <= slen - 1; j++) {
if (kbinput == s[j].val) {
answer = mallocstrcpy(answer, "");
free(inputbuf);
return s[j].val;
}
}
@ -402,6 +403,7 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
}
answer = mallocstrcpy(answer, inputbuf);
free(inputbuf);
/* Now that the text is editable instead of bracketed, we have to
check for answer == def, instead of answer == "" */