diff options
Diffstat (limited to 'apps/player/keyboard.c')
-rw-r--r-- | apps/player/keyboard.c | 84 |
1 files changed, 45 insertions, 39 deletions
diff --git a/apps/player/keyboard.c b/apps/player/keyboard.c index be0e43b8a9..ec40ddf57c 100644 --- a/apps/player/keyboard.c +++ b/apps/player/keyboard.c | |||
@@ -53,9 +53,13 @@ int kbd_input(char* text, int buflen) | |||
53 | lcd_clear_display(); | 53 | lcd_clear_display(); |
54 | 54 | ||
55 | /* draw chars */ | 55 | /* draw chars */ |
56 | for (i=0; i < 11; i++) | 56 | for (i=0; i < 11; i++) { |
57 | lcd_putc(i, 1, line[i+x]); | 57 | if (line[i+x]) |
58 | 58 | lcd_putc(i, 1, line[i+x]); | |
59 | else | ||
60 | break; | ||
61 | } | ||
62 | |||
59 | /* write out the text */ | 63 | /* write out the text */ |
60 | if (len <= 11) { | 64 | if (len <= 11) { |
61 | /* if we have enough room */ | 65 | /* if we have enough room */ |
@@ -70,47 +74,49 @@ int kbd_input(char* text, int buflen) | |||
70 | 74 | ||
71 | switch ( button_get(true) ) { | 75 | switch ( button_get(true) ) { |
72 | 76 | ||
73 | case BUTTON_MENU: | 77 | case BUTTON_MENU: |
74 | /* Page */ | 78 | /* shift */ |
75 | if (++page == KEYBOARD_PAGES) | 79 | if (++page == KEYBOARD_PAGES) |
76 | page = 0; | 80 | page = 0; |
77 | line = kbd_setupkeys(page); | 81 | line = kbd_setupkeys(page); |
78 | linelen = strlen(line); | 82 | linelen = strlen(line); |
79 | break; | 83 | break; |
80 | 84 | ||
81 | case BUTTON_RIGHT: | 85 | case BUTTON_RIGHT: |
82 | if (x < linelen - 1) | 86 | case BUTTON_RIGHT | BUTTON_REPEAT: |
83 | x++; | 87 | if (x < linelen - 1) |
84 | else | 88 | x++; |
85 | x = 0; | 89 | else |
86 | break; | 90 | x = 0; |
91 | break; | ||
87 | 92 | ||
88 | case BUTTON_LEFT: | 93 | case BUTTON_LEFT: |
89 | if (x) | 94 | case BUTTON_LEFT | BUTTON_REPEAT: |
90 | x--; | 95 | if (x) |
91 | else | 96 | x--; |
92 | x = linelen - 1; | 97 | else |
93 | break; | 98 | x = linelen - 1; |
99 | break; | ||
94 | 100 | ||
95 | case BUTTON_STOP: | 101 | case BUTTON_STOP: |
96 | /* backspace */ | 102 | /* backspace */ |
97 | if (len) | 103 | if (len) |
98 | text[len-1] = 0; | 104 | text[len-1] = 0; |
99 | break; | 105 | break; |
100 | 106 | ||
101 | case BUTTON_ON: | 107 | case BUTTON_ON: |
102 | /* F2 accepts what was entered and continues */ | 108 | /* ON accepts what was entered and continues */ |
103 | done = true; | 109 | done = true; |
104 | break; | 110 | break; |
105 | 111 | ||
106 | case BUTTON_PLAY: | 112 | case BUTTON_PLAY: |
107 | /* PLAY inserts the selected char */ | 113 | /* PLAY inserts the selected char */ |
108 | if (len<buflen) | 114 | if (len<buflen) |
109 | { | 115 | { |
110 | text[len] = line[x]; | 116 | text[len] = line[x]; |
111 | text[len+1] = 0; | 117 | text[len+1] = 0; |
112 | } | 118 | } |
113 | break; | 119 | break; |
114 | } | 120 | } |
115 | } | 121 | } |
116 | return 0; | 122 | return 0; |