summaryrefslogtreecommitdiff
path: root/apps/player
diff options
context:
space:
mode:
Diffstat (limited to 'apps/player')
-rw-r--r--apps/player/keyboard.c31
1 files changed, 9 insertions, 22 deletions
diff --git a/apps/player/keyboard.c b/apps/player/keyboard.c
index 6467ed60f1..fb06a0dc7b 100644
--- a/apps/player/keyboard.c
+++ b/apps/player/keyboard.c
@@ -102,7 +102,6 @@ int kbd_input(char* text, int buflen)
102 int editpos, curpos, leftpos; 102 int editpos, curpos, leftpos;
103 unsigned short* line = kbd_setupkeys(page, &linelen); 103 unsigned short* line = kbd_setupkeys(page, &linelen);
104 unsigned char temptext[12]; 104 unsigned char temptext[12];
105 char c;
106 105
107 int button, lastbutton = 0; 106 int button, lastbutton = 0;
108 107
@@ -130,11 +129,11 @@ int kbd_input(char* text, int buflen)
130 129
131 /* Draw insert chars */ 130 /* Draw insert chars */
132 temptext[0] = KEYBOARD_INSERT_LEFT; 131 temptext[0] = KEYBOARD_INSERT_LEFT;
133 temptext[1] = line[x%linelen]; 132 temptext[1] = line[x];
134 temptext[2] = KEYBOARD_INSERT_RIGHT; 133 temptext[2] = KEYBOARD_INSERT_RIGHT;
135 for (i = 1; i < 8; i++) 134 for (i = 1; i < 8; i++)
136 { 135 {
137 temptext[i+2] = line[(i+x)%linelen]; 136 temptext[i+2] = line[(x+i)%linelen];
138 } 137 }
139 temptext[i+2] = 0; 138 temptext[i+2] = 0;
140 lcd_puts(1, 0, temptext); 139 lcd_puts(1, 0, temptext);
@@ -194,9 +193,7 @@ int kbd_input(char* text, int buflen)
194 } 193 }
195 else 194 else
196 { 195 {
197 if (x < linelen - 1) 196 if (++x >= linelen)
198 x++;
199 else
200 x = 0; 197 x = 0;
201 kbd_spellchar(line[x]); 198 kbd_spellchar(line[x]);
202 } 199 }
@@ -214,9 +211,7 @@ int kbd_input(char* text, int buflen)
214 } 211 }
215 else 212 else
216 { 213 {
217 if (x) 214 if (--x < 0)
218 x--;
219 else
220 x = linelen - 1; 215 x = linelen - 1;
221 kbd_spellchar(line[x]); 216 kbd_spellchar(line[x]);
222 } 217 }
@@ -242,20 +237,12 @@ int kbd_input(char* text, int buflen)
242 } 237 }
243 else /* inserts the selected char */ 238 else /* inserts the selected char */
244 { 239 {
245 if (len < buflen) 240 if (len + 1 < buflen)
246 { 241 {
247 c = line[x]; 242 for (i = len ; i > editpos; i--)
248 if (editpos == len) 243 text[i] = text[i-1];
249 { 244 text[len+1] = 0;
250 text[len] = c; 245 text[editpos] = line[x];
251 text[len+1] = 0;
252 }
253 else
254 {
255 for (i = len ; i >= editpos; i--)
256 text[i+1] = text[i];
257 text[editpos] = c;
258 }
259 editpos++; 246 editpos++;
260 } 247 }
261 } 248 }