From 6ed333e3d7630bab4f885407b1f4cf434b7730ad Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Fri, 9 Jul 2004 13:11:16 +0000 Subject: Fixed the Player keyboard cursor positioning, bug #983404 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4861 a1c6a512-1295-4272-9138-f99709370657 --- apps/player/keyboard.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'apps/player') 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