forked from len0rd/rockbox
Fixed the Player keyboard cursor positioning, bug #983404
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4861 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
7c931a12ec
commit
6ed333e3d7
1 changed files with 23 additions and 6 deletions
|
|
@ -104,13 +104,30 @@ int kbd_input(char* text, int buflen)
|
||||||
while (!done) {
|
while (!done) {
|
||||||
int i, p;
|
int i, p;
|
||||||
int len = strlen(text);
|
int len = strlen(text);
|
||||||
|
int scrpos;
|
||||||
|
int dir;
|
||||||
|
|
||||||
|
scrpos = cursor_pos - left_pos;
|
||||||
|
dir = cursor_pos - old_cursor_pos;
|
||||||
|
|
||||||
|
/* Keep the cursor on screen, with a 2 character scroll margin */
|
||||||
|
if(dir < 0) {
|
||||||
|
if(scrpos < 2) {
|
||||||
|
left_pos = cursor_pos - 2;
|
||||||
|
if(left_pos < 0)
|
||||||
|
left_pos = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(dir > 0) {
|
||||||
|
if(scrpos > 7) {
|
||||||
|
left_pos = cursor_pos - 9;
|
||||||
|
if(left_pos < 0)
|
||||||
|
left_pos = 0;
|
||||||
|
if(left_pos > len - 9)
|
||||||
|
left_pos = len - 9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* draw input */
|
|
||||||
if (old_cursor_pos<cursor_pos && 7<(cursor_pos-left_pos) && cursor_pos<(len-1))
|
|
||||||
left_pos++;
|
|
||||||
else
|
|
||||||
if (cursor_pos<old_cursor_pos && (cursor_pos-left_pos)<2 && 0<left_pos)
|
|
||||||
left_pos--;
|
|
||||||
p=0;
|
p=0;
|
||||||
i = left_pos;
|
i = left_pos;
|
||||||
while (p<10 && text[i]) {
|
while (p<10 && text[i]) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue