summaryrefslogtreecommitdiffstats
path: root/apps/player
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-07-09 13:11:16 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-07-09 13:11:16 +0000
commit6ed333e3d7630bab4f885407b1f4cf434b7730ad (patch)
tree677c933047b33033c798cfd3284e970af6f7cd39 /apps/player
parent7c931a12ec3747f7822dcd5ff1dd3255344a46f6 (diff)
downloadrockbox-6ed333e3d7630bab4f885407b1f4cf434b7730ad.tar.gz
rockbox-6ed333e3d7630bab4f885407b1f4cf434b7730ad.tar.bz2
rockbox-6ed333e3d7630bab4f885407b1f4cf434b7730ad.zip
Fixed the Player keyboard cursor positioning, bug #983404
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4861 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/player')
-rw-r--r--apps/player/keyboard.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/apps/player/keyboard.c b/apps/player/keyboard.c
index 9c857765b5..495102b29a 100644
--- a/apps/player/keyboard.c
+++ b/apps/player/keyboard.c
@@ -104,13 +104,30 @@ int kbd_input(char* text, int buflen)
while (!done) {
int i, p;
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;
i = left_pos;
while (p<10 && text[i]) {