Rocco's findnextstr fixes, lost of other tweaks
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@242 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
f9b6c9b398
commit
a0e957bc0d
13
ChangeLog
13
ChangeLog
|
@ -3,10 +3,23 @@ CVS Code -
|
||||||
toggle_init()
|
toggle_init()
|
||||||
- Added #ifdef around toggle_regex_msg to get rid of compiler
|
- Added #ifdef around toggle_regex_msg to get rid of compiler
|
||||||
warning.
|
warning.
|
||||||
|
- search.c
|
||||||
|
findnexstr()
|
||||||
|
- New arg for begin_x variable, basically a rewrite that
|
||||||
|
makes a little more sense and isn't quite as messy (Rocco Corsi).
|
||||||
|
- Update the line we're checking if not the whole screen, because
|
||||||
|
it's quite possible the search team could exist somewhere way
|
||||||
|
to the right on the same line, for example.
|
||||||
|
replace_abort()
|
||||||
|
- Add reset of placewewant, stops cursor from jumping when moving
|
||||||
|
cursor after a replace.
|
||||||
- winio.c
|
- winio.c
|
||||||
nanogetstr()
|
nanogetstr()
|
||||||
- Added check for 343 in while loop to get rid of getting "locked"
|
- Added check for 343 in while loop to get rid of getting "locked"
|
||||||
into statusbar" bug in odd $TERMs like iris-ansi.
|
into statusbar" bug in odd $TERMs like iris-ansi.
|
||||||
|
nanoget_repaint()
|
||||||
|
- New function, removes about 30 lines of duplicate code in
|
||||||
|
nanogetstr().
|
||||||
|
|
||||||
nano 0.9.19 - 10/02/2000
|
nano 0.9.19 - 10/02/2000
|
||||||
- General
|
- General
|
||||||
|
|
70
po/nano.pot
70
po/nano.pot
|
@ -6,7 +6,7 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"POT-Creation-Date: 2000-10-18 15:38-0400\n"
|
"POT-Creation-Date: 2000-10-24 01:12-0400\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
@ -32,7 +32,7 @@ msgstr ""
|
||||||
msgid "Read %d lines"
|
msgid "Read %d lines"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: files.c:217 search.c:177
|
#: files.c:217 search.c:159 search.c:194
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "\"%s\" not found"
|
msgid "\"%s\" not found"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -380,7 +380,7 @@ msgid "Case Sens"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: global.c:342 global.c:361 global.c:371 global.c:387 global.c:391
|
#: global.c:342 global.c:361 global.c:371 global.c:387 global.c:391
|
||||||
#: global.c:397 winio.c:1004
|
#: global.c:397 winio.c:979
|
||||||
msgid "Cancel"
|
msgid "Cancel"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -725,79 +725,79 @@ msgstr ""
|
||||||
msgid "I got Alt-%c! (%d)\n"
|
msgid "I got Alt-%c! (%d)\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: search.c:75
|
#: search.c:77
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Case Sensitive Regexp Search%s%s"
|
msgid "Case Sensitive Regexp Search%s%s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: search.c:77
|
#: search.c:79
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Regexp Search%s%s"
|
msgid "Regexp Search%s%s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: search.c:80
|
#: search.c:82
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Case Sensitive Search%s%s"
|
msgid "Case Sensitive Search%s%s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: search.c:82
|
#: search.c:84
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Search%s%s"
|
msgid "Search%s%s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: search.c:85
|
#: search.c:87
|
||||||
msgid " (to replace)"
|
msgid " (to replace)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: search.c:93
|
#: search.c:95
|
||||||
msgid "Search Cancelled"
|
msgid "Search Cancelled"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: search.c:191
|
#: search.c:175
|
||||||
msgid "Search Wrapped"
|
msgid "Search Wrapped"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: search.c:242
|
#: search.c:254
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Replaced %d occurences"
|
msgid "Replaced %d occurences"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: search.c:244
|
#: search.c:256
|
||||||
msgid "Replaced 1 occurence"
|
msgid "Replaced 1 occurence"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: search.c:379 search.c:400 search.c:423
|
#: search.c:392 search.c:413 search.c:436
|
||||||
msgid "Replace Cancelled"
|
msgid "Replace Cancelled"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: search.c:396
|
#: search.c:409
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Replace with [%s]"
|
msgid "Replace with [%s]"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. last_search is empty
|
#. last_search is empty
|
||||||
#: search.c:421
|
#: search.c:434
|
||||||
msgid "Replace with"
|
msgid "Replace with"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: search.c:462
|
#: search.c:475
|
||||||
msgid "Replace this instance?"
|
msgid "Replace this instance?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. Ask for it
|
#. Ask for it
|
||||||
#: search.c:513
|
#: search.c:536
|
||||||
msgid "Enter line number"
|
msgid "Enter line number"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: search.c:515
|
#: search.c:538
|
||||||
msgid "Aborted"
|
msgid "Aborted"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: search.c:535
|
#: search.c:558
|
||||||
msgid "Come on, be reasonable"
|
msgid "Come on, be reasonable"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: search.c:540
|
#: search.c:563
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Only %d lines available, skipping to last line"
|
msgid "Only %d lines available, skipping to last line"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -807,67 +807,67 @@ msgstr ""
|
||||||
msgid "actual_x_from_start for xplus=%d returned %d\n"
|
msgid "actual_x_from_start for xplus=%d returned %d\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: winio.c:415
|
#: winio.c:390
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "input '%c' (%d)\n"
|
msgid "input '%c' (%d)\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: winio.c:449
|
#: winio.c:424
|
||||||
msgid "New Buffer"
|
msgid "New Buffer"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: winio.c:452
|
#: winio.c:427
|
||||||
msgid " File: ..."
|
msgid " File: ..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: winio.c:460
|
#: winio.c:435
|
||||||
msgid "Modified"
|
msgid "Modified"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: winio.c:920
|
#: winio.c:895
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Moved to (%d, %d) in edit buffer\n"
|
msgid "Moved to (%d, %d) in edit buffer\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: winio.c:931
|
#: winio.c:906
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "current->data = \"%s\"\n"
|
msgid "current->data = \"%s\"\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: winio.c:974
|
#: winio.c:949
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "I got \"%s\"\n"
|
msgid "I got \"%s\"\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: winio.c:999
|
#: winio.c:974
|
||||||
msgid "Yes"
|
msgid "Yes"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: winio.c:1001
|
#: winio.c:976
|
||||||
msgid "All"
|
msgid "All"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: winio.c:1003
|
#: winio.c:978
|
||||||
msgid "No"
|
msgid "No"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: winio.c:1140
|
#: winio.c:1115
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "do_cursorpos: linepct = %f, bytepct = %f\n"
|
msgid "do_cursorpos: linepct = %f, bytepct = %f\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: winio.c:1144
|
#: winio.c:1119
|
||||||
msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
|
msgid "line %d of %d (%.0f%%), character %d of %d (%.0f%%)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: winio.c:1272
|
#: winio.c:1247
|
||||||
msgid "Dumping file buffer to stderr...\n"
|
msgid "Dumping file buffer to stderr...\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: winio.c:1274
|
#: winio.c:1249
|
||||||
msgid "Dumping cutbuffer to stderr...\n"
|
msgid "Dumping cutbuffer to stderr...\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: winio.c:1276
|
#: winio.c:1251
|
||||||
msgid "Dumping a buffer to stderr...\n"
|
msgid "Dumping a buffer to stderr...\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
125
search.c
125
search.c
|
@ -36,6 +36,8 @@
|
||||||
|
|
||||||
static char last_search[132] = ""; /* Last string we searched for */
|
static char last_search[132] = ""; /* Last string we searched for */
|
||||||
static char last_replace[132] = ""; /* Last replacement string */
|
static char last_replace[132] = ""; /* Last replacement string */
|
||||||
|
static int search_last_line;
|
||||||
|
|
||||||
|
|
||||||
/* Regular expression helper functions */
|
/* Regular expression helper functions */
|
||||||
|
|
||||||
|
@ -128,7 +130,7 @@ int search_init(int replacing)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
filestruct *findnextstr(int quiet, filestruct * begin, char *needle)
|
filestruct *findnextstr(int quiet, filestruct * begin, int beginx, char *needle)
|
||||||
{
|
{
|
||||||
filestruct *fileptr;
|
filestruct *fileptr;
|
||||||
char *searchstr, *found = NULL, *tmp;
|
char *searchstr, *found = NULL, *tmp;
|
||||||
|
@ -136,62 +138,71 @@ filestruct *findnextstr(int quiet, filestruct * begin, char *needle)
|
||||||
|
|
||||||
fileptr = current;
|
fileptr = current;
|
||||||
|
|
||||||
searchstr = ¤t->data[current_x + 1];
|
current_x++;
|
||||||
/* Look for searchstr until EOF */
|
|
||||||
while (fileptr != NULL &&
|
/* Are we searching the last line? (i.e. the line where search started) */
|
||||||
(found = strstrwrapper(searchstr, needle)) == NULL) {
|
if ( (fileptr == begin) && (current_x < beginx) )
|
||||||
|
search_last_line = 1;
|
||||||
|
|
||||||
|
/* Make sure we haven't passed the end of the string */
|
||||||
|
if ( strlen(fileptr->data) < current_x )
|
||||||
|
current_x--;
|
||||||
|
|
||||||
|
searchstr = &fileptr->data[current_x];
|
||||||
|
|
||||||
|
/* Look for needle in searchstr */
|
||||||
|
while (( found = strstrwrapper(searchstr, needle)) == NULL) {
|
||||||
|
|
||||||
|
/* finished processing file, get out */
|
||||||
|
if (search_last_line) {
|
||||||
|
if (!quiet)
|
||||||
|
statusbar(_("\"%s\" not found"), needle);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
fileptr = fileptr->next;
|
fileptr = fileptr->next;
|
||||||
|
|
||||||
if (!past_editbot && (fileptr == editbot))
|
if (!past_editbot && (fileptr == editbot))
|
||||||
past_editbot = 1;
|
past_editbot = 1;
|
||||||
|
|
||||||
if (fileptr == begin)
|
/* EOF reached, wrap around once */
|
||||||
return NULL;
|
if (fileptr == NULL) {
|
||||||
|
fileptr = fileage;
|
||||||
|
|
||||||
if (fileptr != NULL)
|
past_editbot = 1;
|
||||||
searchstr = fileptr->data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If we're not at EOF, we found an instance */
|
|
||||||
if (fileptr != NULL) {
|
|
||||||
current = fileptr;
|
|
||||||
current_x = 0;
|
|
||||||
for (tmp = fileptr->data; tmp != found; tmp++)
|
|
||||||
current_x++;
|
|
||||||
|
|
||||||
if (past_editbot)
|
|
||||||
edit_update(current, CENTER);
|
|
||||||
placewewant = xplustabs();
|
|
||||||
reset_cursor();
|
|
||||||
} else { /* We're at EOF, go back to the top, once */
|
|
||||||
|
|
||||||
fileptr = fileage;
|
|
||||||
|
|
||||||
while (fileptr != begin->next &&
|
|
||||||
(found = strstrwrapper(fileptr->data, needle)) == NULL)
|
|
||||||
fileptr = fileptr->next;
|
|
||||||
|
|
||||||
if (fileptr == begin->next) {
|
|
||||||
if (!quiet)
|
|
||||||
statusbar(_("\"%s\" not found"), needle);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
else { /* We found something */
|
|
||||||
current = fileptr;
|
|
||||||
current_x = 0;
|
|
||||||
for (tmp = fileptr->data; tmp != found; tmp++)
|
|
||||||
current_x++;
|
|
||||||
|
|
||||||
edit_update(current, CENTER);
|
|
||||||
reset_cursor();
|
|
||||||
|
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
statusbar(_("Search Wrapped"));
|
statusbar(_("Search Wrapped"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Original start line reached */
|
||||||
|
if (fileptr == begin)
|
||||||
|
search_last_line = 1;
|
||||||
|
|
||||||
|
searchstr = fileptr->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We found an instance */
|
||||||
|
current = fileptr;
|
||||||
|
current_x = 0;
|
||||||
|
for (tmp = fileptr->data; tmp != found; tmp++)
|
||||||
|
current_x++;
|
||||||
|
|
||||||
|
/* Ensure we haven't wrap around again! */
|
||||||
|
if ((search_last_line) && (current_x >= beginx)) {
|
||||||
|
if (!quiet)
|
||||||
|
statusbar(_("\"%s\" not found"), needle);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (past_editbot)
|
||||||
|
edit_update(fileptr, CENTER);
|
||||||
|
else
|
||||||
|
update_line(current, current_x);
|
||||||
|
|
||||||
|
placewewant = xplustabs();
|
||||||
|
reset_cursor();
|
||||||
|
|
||||||
return fileptr;
|
return fileptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +242,8 @@ int do_search(void)
|
||||||
search_abort();
|
search_abort();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
findnextstr(0, current, answer);
|
search_last_line = 0;
|
||||||
|
findnextstr(0, current, current_x, answer);
|
||||||
search_abort();
|
search_abort();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -250,6 +262,7 @@ void replace_abort(void)
|
||||||
does something different later, we can change it back. For now
|
does something different later, we can change it back. For now
|
||||||
it's just a waste to duplicat code */
|
it's just a waste to duplicat code */
|
||||||
search_abort();
|
search_abort();
|
||||||
|
placewewant = xplustabs();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
|
@ -421,7 +434,6 @@ int do_replace(void)
|
||||||
i = statusq(replace_list, REPLACE_LIST_LEN, "", _("Replace with"));
|
i = statusq(replace_list, REPLACE_LIST_LEN, "", _("Replace with"));
|
||||||
if (i == -1) {
|
if (i == -1) {
|
||||||
statusbar(_("Replace Cancelled"));
|
statusbar(_("Replace Cancelled"));
|
||||||
reset_cursor();
|
|
||||||
replace_abort();
|
replace_abort();
|
||||||
return 0;
|
return 0;
|
||||||
} else if (i == 0) /* They entered something new */
|
} else if (i == 0) /* They entered something new */
|
||||||
|
@ -444,14 +456,15 @@ int do_replace(void)
|
||||||
|
|
||||||
/* save where we are */
|
/* save where we are */
|
||||||
begin = current;
|
begin = current;
|
||||||
beginx = current_x;
|
beginx = current_x + 1;
|
||||||
|
search_last_line = 0;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
if (replaceall)
|
if (replaceall)
|
||||||
fileptr = findnextstr(1, begin, prevanswer);
|
fileptr = findnextstr(1, begin, beginx, prevanswer);
|
||||||
else
|
else
|
||||||
fileptr = findnextstr(0, begin, prevanswer);
|
fileptr = findnextstr(0, begin, beginx, prevanswer);
|
||||||
|
|
||||||
/* No more matches. Done! */
|
/* No more matches. Done! */
|
||||||
if (!fileptr)
|
if (!fileptr)
|
||||||
|
@ -479,6 +492,16 @@ int do_replace(void)
|
||||||
/* Stop bug where we replace a substring of the replacement text */
|
/* Stop bug where we replace a substring of the replacement text */
|
||||||
current_x += strlen(last_replace) - 1;
|
current_x += strlen(last_replace) - 1;
|
||||||
|
|
||||||
|
/* Adjust the original cursor position - COULD BE IMPROVED */
|
||||||
|
if (search_last_line) {
|
||||||
|
beginx += strlen(last_replace) - strlen(last_search);
|
||||||
|
|
||||||
|
/* For strings that cross the search start/end boundary */
|
||||||
|
/* Don't go outside of allocated memory */
|
||||||
|
if (beginx < 1)
|
||||||
|
beginx = 1;
|
||||||
|
}
|
||||||
|
|
||||||
edit_refresh();
|
edit_refresh();
|
||||||
set_modified();
|
set_modified();
|
||||||
numreplaced++;
|
numreplaced++;
|
||||||
|
@ -487,7 +510,7 @@ int do_replace(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
current = begin;
|
current = begin;
|
||||||
current_x = beginx;
|
current_x = beginx - 1;
|
||||||
renumber_all();
|
renumber_all();
|
||||||
edit_update(current, CENTER);
|
edit_update(current, CENTER);
|
||||||
print_replaced(numreplaced);
|
print_replaced(numreplaced);
|
||||||
|
|
65
winio.c
65
winio.c
|
@ -218,6 +218,15 @@ void check_statblank(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Repaint the statusbar when getting a character in nanogetstr */
|
||||||
|
void nanoget_repaint(char *buf, char *inputbuf, int x)
|
||||||
|
{
|
||||||
|
blank_statusbar();
|
||||||
|
mvwaddstr(bottomwin, 0, 0, buf);
|
||||||
|
waddstr(bottomwin, inputbuf);
|
||||||
|
wmove(bottomwin, 0, x);
|
||||||
|
}
|
||||||
|
|
||||||
/* Get the input from the kb, this should only be called from statusq */
|
/* Get the input from the kb, this should only be called from statusq */
|
||||||
int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
|
int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
|
||||||
{
|
{
|
||||||
|
@ -257,17 +266,11 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
|
||||||
|
|
||||||
case KEY_HOME:
|
case KEY_HOME:
|
||||||
x = x_left;
|
x = x_left;
|
||||||
blank_statusbar();
|
nanoget_repaint(buf, inputbuf, x);
|
||||||
mvwaddstr(bottomwin, 0, 0, buf);
|
|
||||||
waddstr(bottomwin, inputbuf);
|
|
||||||
wmove(bottomwin, 0, x);
|
|
||||||
break;
|
break;
|
||||||
case KEY_END:
|
case KEY_END:
|
||||||
x = x_left + strlen(inputbuf);
|
x = x_left + strlen(inputbuf);
|
||||||
blank_statusbar();
|
nanoget_repaint(buf, inputbuf, x);
|
||||||
mvwaddstr(bottomwin, 0, 0, buf);
|
|
||||||
waddstr(bottomwin, inputbuf);
|
|
||||||
wmove(bottomwin, 0, x);
|
|
||||||
break;
|
break;
|
||||||
case KEY_RIGHT:
|
case KEY_RIGHT:
|
||||||
|
|
||||||
|
@ -282,19 +285,13 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
|
||||||
strlen(inputbuf) - (x - x_left) - 1);
|
strlen(inputbuf) - (x - x_left) - 1);
|
||||||
inputbuf[strlen(inputbuf) - 1] = 0;
|
inputbuf[strlen(inputbuf) - 1] = 0;
|
||||||
}
|
}
|
||||||
blank_statusbar();
|
nanoget_repaint(buf, inputbuf, x);
|
||||||
mvwaddstr(bottomwin, 0, 0, buf);
|
|
||||||
waddstr(bottomwin, inputbuf);
|
|
||||||
wmove(bottomwin, 0, x);
|
|
||||||
break;
|
break;
|
||||||
case NANO_CONTROL_K:
|
case NANO_CONTROL_K:
|
||||||
case NANO_CONTROL_U:
|
case NANO_CONTROL_U:
|
||||||
*inputbuf = 0;
|
*inputbuf = 0;
|
||||||
x = x_left;
|
x = x_left;
|
||||||
blank_statusbar();
|
nanoget_repaint(buf, inputbuf, x);
|
||||||
mvwaddstr(bottomwin, 0, 0, buf);
|
|
||||||
waddstr(bottomwin, inputbuf);
|
|
||||||
wmove(bottomwin, 0, x);
|
|
||||||
break;
|
break;
|
||||||
case KEY_BACKSPACE:
|
case KEY_BACKSPACE:
|
||||||
case KEY_DC:
|
case KEY_DC:
|
||||||
|
@ -328,17 +325,11 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
|
||||||
switch (kbinput = wgetch(edit)) {
|
switch (kbinput = wgetch(edit)) {
|
||||||
case 70:
|
case 70:
|
||||||
x = x_left + strlen(inputbuf);
|
x = x_left + strlen(inputbuf);
|
||||||
blank_statusbar();
|
nanoget_repaint(buf, inputbuf, x);
|
||||||
mvwaddstr(bottomwin, 0, 0, buf);
|
|
||||||
waddstr(bottomwin, inputbuf);
|
|
||||||
wmove(bottomwin, 0, x);
|
|
||||||
break;
|
break;
|
||||||
case 72:
|
case 72:
|
||||||
x = x_left;
|
x = x_left;
|
||||||
blank_statusbar();
|
nanoget_repaint(buf, inputbuf, x);
|
||||||
mvwaddstr(bottomwin, 0, 0, buf);
|
|
||||||
waddstr(bottomwin, inputbuf);
|
|
||||||
wmove(bottomwin, 0, x);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -356,10 +347,7 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
|
||||||
break;
|
break;
|
||||||
case 49:
|
case 49:
|
||||||
x = x_left;
|
x = x_left;
|
||||||
blank_statusbar();
|
nanoget_repaint(buf, inputbuf, x);
|
||||||
mvwaddstr(bottomwin, 0, 0, buf);
|
|
||||||
waddstr(bottomwin, inputbuf);
|
|
||||||
wmove(bottomwin, 0, x);
|
|
||||||
goto skip_126;
|
goto skip_126;
|
||||||
case 51:
|
case 51:
|
||||||
if (strlen(inputbuf) > 0
|
if (strlen(inputbuf) > 0
|
||||||
|
@ -369,17 +357,11 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
|
||||||
strlen(inputbuf) - (x - x_left) - 1);
|
strlen(inputbuf) - (x - x_left) - 1);
|
||||||
inputbuf[strlen(inputbuf) - 1] = 0;
|
inputbuf[strlen(inputbuf) - 1] = 0;
|
||||||
}
|
}
|
||||||
blank_statusbar();
|
nanoget_repaint(buf, inputbuf, x);
|
||||||
mvwaddstr(bottomwin, 0, 0, buf);
|
|
||||||
waddstr(bottomwin, inputbuf);
|
|
||||||
wmove(bottomwin, 0, x);
|
|
||||||
goto skip_126;
|
goto skip_126;
|
||||||
case 52:
|
case 52:
|
||||||
x = x_left + strlen(inputbuf);
|
x = x_left + strlen(inputbuf);
|
||||||
blank_statusbar();
|
nanoget_repaint(buf, inputbuf, x);
|
||||||
mvwaddstr(bottomwin, 0, 0, buf);
|
|
||||||
waddstr(bottomwin, inputbuf);
|
|
||||||
wmove(bottomwin, 0, x);
|
|
||||||
goto skip_126;
|
goto skip_126;
|
||||||
skip_126:
|
skip_126:
|
||||||
nodelay(edit, TRUE);
|
nodelay(edit, TRUE);
|
||||||
|
@ -390,13 +372,9 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
blank_statusbar();
|
nanoget_repaint(buf, inputbuf, x);
|
||||||
mvwaddstr(bottomwin, 0, 0, buf);
|
|
||||||
waddstr(bottomwin, inputbuf);
|
|
||||||
wmove(bottomwin, 0, x);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (kbinput < 32)
|
if (kbinput < 32)
|
||||||
break;
|
break;
|
||||||
|
@ -407,10 +385,7 @@ int nanogetstr(char *buf, char *def, shortcut s[], int slen, int start_x)
|
||||||
strcpy(inputbuf, inputstr);
|
strcpy(inputbuf, inputstr);
|
||||||
x++;
|
x++;
|
||||||
|
|
||||||
mvwaddstr(bottomwin, 0, 0, buf);
|
nanoget_repaint(buf, inputbuf, x);
|
||||||
waddstr(bottomwin, inputbuf);
|
|
||||||
wmove(bottomwin, 0, x);
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, _("input \'%c\' (%d)\n"), kbinput, kbinput);
|
fprintf(stderr, _("input \'%c\' (%d)\n"), kbinput, kbinput);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue