Rev 606 | Rev 609 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 606 | Rev 607 | ||
---|---|---|---|
Line 245... | Line 245... | ||
245 | while (1) { |
245 | while (1) { |
246 | c = _getc(input); |
246 | c = _getc(input); |
247 | if (c == '\n') { |
247 | if (c == '\n') { |
248 | putchar(c); |
248 | putchar(c); |
249 | break; |
249 | break; |
250 | } if (c == '\b') { |
250 | } if (c == '\b') { /* Backspace */ |
251 | if (position == 0) |
251 | if (position == 0) |
252 | continue; |
252 | continue; |
253 | for (i=position; i<curlen;i++) |
253 | for (i=position; i<curlen;i++) |
254 | current[i-1] = current[i]; |
254 | current[i-1] = current[i]; |
255 | curlen--; |
255 | curlen--; |
Line 259... | Line 259... | ||
259 | putchar(current[i]); |
259 | putchar(current[i]); |
260 | putchar(' '); |
260 | putchar(' '); |
261 | rdln_print_c('\b',curlen-position+1); |
261 | rdln_print_c('\b',curlen-position+1); |
262 | continue; |
262 | continue; |
263 | } |
263 | } |
264 | if (c == '\t') { |
264 | if (c == '\t') { /* Tabulator */ |
265 | int found; |
265 | int found; |
266 | 266 | ||
267 | /* Move to the end of the word */ |
267 | /* Move to the end of the word */ |
268 | for (;position<curlen && current[position]!=' ';position++) |
268 | for (;position<curlen && current[position]!=' ';position++) |
269 | putchar(current[position]); |
269 | putchar(current[position]); |
Line 307... | Line 307... | ||
307 | position += strlen(tmp); |
307 | position += strlen(tmp); |
308 | } |
308 | } |
309 | rdln_print_c('\b', curlen-position); |
309 | rdln_print_c('\b', curlen-position); |
310 | continue; |
310 | continue; |
311 | } |
311 | } |
312 | if (c == 0x1b) { |
312 | if (c == 0x1b) { /* Special command */ |
313 | mod = _getc(input); |
313 | mod = _getc(input); |
314 | c = _getc(input); |
314 | c = _getc(input); |
315 | 315 | ||
316 | if (mod != 0x5b && mod != 0x4f) |
316 | if (mod != 0x5b && mod != 0x4f) |
317 | continue; |
317 | continue; |
318 | 318 | ||
319 | if (c == 0x33 && _getc(input) == 0x7e) { |
319 | if (c == 0x33 && _getc(input) == 0x7e) { |
- | 320 | /* Delete */ |
|
320 | if (position == curlen) |
321 | if (position == curlen) |
321 | continue; |
322 | continue; |
322 | for (i=position+1; i<curlen;i++) { |
323 | for (i=position+1; i<curlen;i++) { |
323 | putchar(current[i]); |
324 | putchar(current[i]); |
324 | current[i-1] = current[i]; |
325 | current[i-1] = current[i]; |
Line 329... | Line 330... | ||
329 | } |
330 | } |
330 | else if (c == 0x48) { /* Home */ |
331 | else if (c == 0x48) { /* Home */ |
331 | rdln_print_c('\b',position); |
332 | rdln_print_c('\b',position); |
332 | position = 0; |
333 | position = 0; |
333 | } |
334 | } |
334 | else if (c == 0x46) { |
335 | else if (c == 0x46) { /* End */ |
335 | for (i=position;i<curlen;i++) |
336 | for (i=position;i<curlen;i++) |
336 | putchar(current[i]); |
337 | putchar(current[i]); |
337 | position = curlen; |
338 | position = curlen; |
338 | } |
339 | } |
339 | else if (c == 0x44) { /* Left */ |
340 | else if (c == 0x44) { /* Left */ |
Line 353... | Line 354... | ||
353 | else if (c == 0x41 || c == 0x42) { |
354 | else if (c == 0x41 || c == 0x42) { |
354 | /* Up,down */ |
355 | /* Up,down */ |
355 | rdln_print_c('\b',position); |
356 | rdln_print_c('\b',position); |
356 | rdln_print_c(' ',curlen); |
357 | rdln_print_c(' ',curlen); |
357 | rdln_print_c('\b',curlen); |
358 | rdln_print_c('\b',curlen); |
358 | if (c == 0x41) |
359 | if (c == 0x41) /* Up */ |
359 | histposition--; |
360 | histposition--; |
360 | else |
361 | else |
361 | histposition++; |
362 | histposition++; |
362 | if (histposition < 0) |
363 | if (histposition < 0) |
363 | histposition = KCONSOLE_HISTORY -1 ; |
364 | histposition = KCONSOLE_HISTORY -1 ; |