winio.c:nanogetstr() - Don't be clever and wasteful, just repaint every iteration
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@809 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
1c27d3e875
Коммит
386e0518b5
14
winio.c
14
winio.c
@ -330,12 +330,10 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
|||||||
case NANO_HOME_KEY:
|
case NANO_HOME_KEY:
|
||||||
case KEY_HOME:
|
case KEY_HOME:
|
||||||
x = x_left;
|
x = x_left;
|
||||||
nanoget_repaint(buf, inputbuf, x);
|
|
||||||
break;
|
break;
|
||||||
case NANO_END_KEY:
|
case NANO_END_KEY:
|
||||||
case KEY_END:
|
case KEY_END:
|
||||||
x = x_left + strlen(inputbuf);
|
x = x_left + strlen(inputbuf);
|
||||||
nanoget_repaint(buf, inputbuf, x);
|
|
||||||
break;
|
break;
|
||||||
case KEY_RIGHT:
|
case KEY_RIGHT:
|
||||||
case NANO_FORWARD_KEY:
|
case NANO_FORWARD_KEY:
|
||||||
@ -351,13 +349,11 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
|||||||
strlen(inputbuf) - (x - x_left) - 1);
|
strlen(inputbuf) - (x - x_left) - 1);
|
||||||
inputbuf[strlen(inputbuf) - 1] = 0;
|
inputbuf[strlen(inputbuf) - 1] = 0;
|
||||||
}
|
}
|
||||||
nanoget_repaint(buf, inputbuf, 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;
|
||||||
nanoget_repaint(buf, inputbuf, x);
|
|
||||||
break;
|
break;
|
||||||
case KEY_BACKSPACE:
|
case KEY_BACKSPACE:
|
||||||
case 127:
|
case 127:
|
||||||
@ -374,7 +370,6 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
|||||||
}
|
}
|
||||||
if (x > strlen(buf))
|
if (x > strlen(buf))
|
||||||
x--;
|
x--;
|
||||||
nanoget_repaint(buf, inputbuf, x);
|
|
||||||
break;
|
break;
|
||||||
#ifndef DISABLE_TABCOMP
|
#ifndef DISABLE_TABCOMP
|
||||||
case NANO_CONTROL_I:
|
case NANO_CONTROL_I:
|
||||||
@ -385,7 +380,6 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
|||||||
x += shift;
|
x += shift;
|
||||||
if (x - x_left > strlen(inputbuf))
|
if (x - x_left > strlen(inputbuf))
|
||||||
x = strlen(inputbuf) + x_left;
|
x = strlen(inputbuf) + x_left;
|
||||||
nanoget_repaint(buf, inputbuf, x);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@ -408,11 +402,9 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
|||||||
switch (kbinput = wgetch(edit)) {
|
switch (kbinput = wgetch(edit)) {
|
||||||
case 'F':
|
case 'F':
|
||||||
x = x_left + strlen(inputbuf);
|
x = x_left + strlen(inputbuf);
|
||||||
nanoget_repaint(buf, inputbuf, x);
|
|
||||||
break;
|
break;
|
||||||
case 'H':
|
case 'H':
|
||||||
x = x_left;
|
x = x_left;
|
||||||
nanoget_repaint(buf, inputbuf, x);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -431,7 +423,6 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
|||||||
case '1':
|
case '1':
|
||||||
case '7':
|
case '7':
|
||||||
x = x_left;
|
x = x_left;
|
||||||
nanoget_repaint(buf, inputbuf, x);
|
|
||||||
goto skip_tilde;
|
goto skip_tilde;
|
||||||
case '3':
|
case '3':
|
||||||
do_deletekey:
|
do_deletekey:
|
||||||
@ -442,12 +433,10 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
|||||||
strlen(inputbuf) - (x - x_left) - 1);
|
strlen(inputbuf) - (x - x_left) - 1);
|
||||||
inputbuf[strlen(inputbuf) - 1] = 0;
|
inputbuf[strlen(inputbuf) - 1] = 0;
|
||||||
}
|
}
|
||||||
nanoget_repaint(buf, inputbuf, x);
|
|
||||||
goto skip_tilde;
|
goto skip_tilde;
|
||||||
case '4':
|
case '4':
|
||||||
case '8':
|
case '8':
|
||||||
x = x_left + strlen(inputbuf);
|
x = x_left + strlen(inputbuf);
|
||||||
nanoget_repaint(buf, inputbuf, x);
|
|
||||||
goto skip_tilde;
|
goto skip_tilde;
|
||||||
skip_tilde:
|
skip_tilde:
|
||||||
nodelay(edit, TRUE);
|
nodelay(edit, TRUE);
|
||||||
@ -475,7 +464,6 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
nanoget_repaint(buf, inputbuf, x);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -493,11 +481,11 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
|
|||||||
|
|
||||||
x++;
|
x++;
|
||||||
|
|
||||||
nanoget_repaint(buf, inputbuf, x);
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, _("input \'%c\' (%d)\n"), kbinput, kbinput);
|
fprintf(stderr, _("input \'%c\' (%d)\n"), kbinput, kbinput);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
nanoget_repaint(buf, inputbuf, x);
|
||||||
wrefresh(bottomwin);
|
wrefresh(bottomwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user