From 0d1e8d66e430b310e4a55b05f99129d0d504b928 Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Thu, 2 Nov 2000 15:30:24 +0000 Subject: [PATCH] Make nanoget_repaint be much more eleet. Uses $ for indication of beyond COLS, prompt is always displayed git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@260 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- po/nano.pot | 34 +++++++++++++++++----------------- winio.c | 29 +++++++++++++++++++---------- 2 files changed, 36 insertions(+), 27 deletions(-) diff --git a/po/nano.pot b/po/nano.pot index 946668ea..53de14ad 100644 --- a/po/nano.pot +++ b/po/nano.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2000-11-02 09:51-0500\n" +"POT-Creation-Date: 2000-11-02 10:29-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \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:983 +#: global.c:405 global.c:411 winio.c:992 msgid "Cancel" msgstr "" @@ -814,67 +814,67 @@ msgstr "" msgid "actual_x_from_start for xplus=%d returned %d\n" msgstr "" -#: winio.c:399 +#: winio.c:408 #, c-format msgid "input '%c' (%d)\n" msgstr "" -#: winio.c:436 +#: winio.c:445 msgid "New Buffer" msgstr "" -#: winio.c:439 +#: winio.c:448 msgid " File: ..." msgstr "" -#: winio.c:447 +#: winio.c:456 msgid "Modified" msgstr "" -#: winio.c:899 +#: winio.c:908 #, c-format msgid "Moved to (%d, %d) in edit buffer\n" msgstr "" -#: winio.c:910 +#: winio.c:919 #, c-format msgid "current->data = \"%s\"\n" msgstr "" -#: winio.c:953 +#: winio.c:962 #, c-format msgid "I got \"%s\"\n" msgstr "" -#: winio.c:978 +#: winio.c:987 msgid "Yes" msgstr "" -#: winio.c:980 +#: winio.c:989 msgid "All" msgstr "" -#: winio.c:982 +#: winio.c:991 msgid "No" msgstr "" -#: winio.c:1119 +#: winio.c:1128 #, c-format msgid "do_cursorpos: linepct = %f, bytepct = %f\n" msgstr "" -#: winio.c:1123 +#: winio.c:1132 msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)" msgstr "" -#: winio.c:1251 +#: winio.c:1260 msgid "Dumping file buffer to stderr...\n" msgstr "" -#: winio.c:1253 +#: winio.c:1262 msgid "Dumping cutbuffer to stderr...\n" msgstr "" -#: winio.c:1255 +#: winio.c:1264 msgid "Dumping a buffer to stderr...\n" msgstr "" diff --git a/winio.c b/winio.c index 2d6abeed..baf92006 100644 --- a/winio.c +++ b/winio.c @@ -221,19 +221,26 @@ void check_statblank(void) /* Repaint the statusbar when getting a character in nanogetstr */ void nanoget_repaint(char *buf, char *inputbuf, int x) { - blank_statusbar(); - if (x <= COLS - 1) { - mvwaddstr(bottomwin, 0, 0, buf); - waddnstr(bottomwin, inputbuf, (COLS - 1) - strlen(buf)); + int len = strlen(buf); + int wid = COLS - len; - } 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 - 1)) - - strlen(buf)], COLS); + blank_statusbar(); + if (x <= COLS - 1) { + /* Black magic */ + buf[len - 1] = ' '; - wmove(bottomwin, 0, (x % (COLS - 1))); + mvwaddstr(bottomwin, 0, 0, buf); + waddnstr(bottomwin, inputbuf, wid); + wmove(bottomwin, 0, (x % COLS)); + } + else { + /* Black magic */ + buf[len - 1] = '$'; + mvwaddstr(bottomwin, 0, 0, buf); + waddnstr(bottomwin, &inputbuf[wid * ((x - len) / (wid))], wid); + wmove(bottomwin, 0, ((x - len) % wid) + len); + } } /* Get the input from the kb, this should only be called from statusq */ @@ -314,7 +321,9 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x) inputbuf[strlen(inputbuf) - 1] = 0; } } + x--; nanoget_repaint(buf, inputbuf, x); + x++; case KEY_LEFT: if (x > strlen(buf)) x--; -- 2.39.5