Rev 4217 | Rev 4224 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4217 | Rev 4223 | ||
---|---|---|---|
Line 257... | Line 257... | ||
257 | /* Backspace */ |
257 | /* Backspace */ |
258 | if (position == 0) |
258 | if (position == 0) |
259 | continue; |
259 | continue; |
260 | 260 | ||
261 | if (wstr_remove(current, position - 1)) { |
261 | if (wstr_remove(current, position - 1)) { |
- | 262 | position--; |
|
262 | putchar('\b'); |
263 | putchar('\b'); |
263 | printf("%ls", current + position); |
264 | printf("%ls ", current + position); |
264 | position--; |
- | |
265 | print_cc('\b', wstr_length(current) - position); |
265 | print_cc('\b', wstr_length(current) - position + 1); |
266 | continue; |
266 | continue; |
267 | } |
267 | } |
268 | } |
268 | } |
269 | 269 | ||
270 | if (ch == '\t') { |
270 | if (ch == '\t') { |
Line 331... | Line 331... | ||
331 | 331 | ||
332 | print_cc('\b', wstr_length(current) - position); |
332 | print_cc('\b', wstr_length(current) - position); |
333 | continue; |
333 | continue; |
334 | } |
334 | } |
335 | 335 | ||
336 | if (ch == 0x1b) { |
336 | if (ch == U_LEFT_ARROW) { |
337 | /* Special command */ |
- | |
338 | wchar_t mod = _getc(indev); |
- | |
339 | wchar_t ch = _getc(indev); |
- | |
340 | - | ||
341 | if ((mod != 0x5b) && (mod != 0x4f)) |
- | |
342 | continue; |
- | |
343 | - | ||
344 | if ((ch == 0x33) && (_getc(indev) == 0x7e)) { |
- | |
345 | /* Delete */ |
- | |
346 | if (position == wstr_length(current)) |
- | |
347 | continue; |
- | |
348 | - | ||
349 | if (wstr_remove(current, position)) { |
- | |
350 | putchar('\b'); |
- | |
351 | printf("%ls", current + position); |
- | |
352 | position--; |
- | |
353 | print_cc('\b', wstr_length(current) - position); |
- | |
354 | } |
- | |
355 | } else if (ch == 0x48) { |
- | |
356 | /* Home */ |
- | |
357 | print_cc('\b', position); |
- | |
358 | position = 0; |
- | |
359 | } else if (ch == 0x46) { |
- | |
360 | /* End */ |
- | |
361 | printf("%ls", current + position); |
- | |
362 | position = wstr_length(current); |
- | |
363 | } else if (ch == 0x44) { |
- | |
364 | /* Left */ |
337 | /* Left */ |
365 | if (position > 0) { |
338 | if (position > 0) { |
366 | putchar('\b'); |
339 | putchar('\b'); |
367 | position--; |
340 | position--; |
368 | } |
341 | } |
- | 342 | continue; |
|
- | 343 | } |
|
- | 344 | ||
369 | } else if (ch == 0x43) { |
345 | if (ch == U_RIGHT_ARROW) { |
370 | /* Right */ |
346 | /* Right */ |
371 | if (position < wstr_length(current)) { |
347 | if (position < wstr_length(current)) { |
372 | putchar(current[position]); |
348 | putchar(current[position]); |
373 | position++; |
349 | position++; |
374 | } |
350 | } |
- | 351 | continue; |
|
- | 352 | } |
|
- | 353 | ||
375 | } else if ((ch == 0x41) || (ch == 0x42)) { |
354 | if ((ch == U_UP_ARROW) || (ch == U_DOWN_ARROW)) { |
376 | /* Up, down */ |
355 | /* Up, down */ |
377 | print_cc('\b', position); |
356 | print_cc('\b', position); |
378 | print_cc(' ', wstr_length(current)); |
357 | print_cc(' ', wstr_length(current)); |
379 | print_cc('\b', wstr_length(current)); |
358 | print_cc('\b', wstr_length(current)); |
380 | 359 | ||
381 | if (ch == 0x41) { |
360 | if (ch == U_UP_ARROW) { |
382 | /* Up */ |
361 | /* Up */ |
383 | if (history_pos == 0) |
362 | if (history_pos == 0) |
384 | history_pos = KCONSOLE_HISTORY - 1; |
363 | history_pos = KCONSOLE_HISTORY - 1; |
385 | else |
364 | else |
386 | history_pos--; |
365 | history_pos--; |
Line 390... | Line 369... | ||
390 | history_pos = history_pos % KCONSOLE_HISTORY; |
369 | history_pos = history_pos % KCONSOLE_HISTORY; |
391 | } |
370 | } |
392 | current = history[history_pos]; |
371 | current = history[history_pos]; |
393 | printf("%ls", current); |
372 | printf("%ls", current); |
394 | position = wstr_length(current); |
373 | position = wstr_length(current); |
- | 374 | continue; |
|
- | 375 | } |
|
- | 376 | ||
- | 377 | if (ch == U_HOME_ARROW) { |
|
- | 378 | /* Home */ |
|
- | 379 | print_cc('\b', position); |
|
- | 380 | position = 0; |
|
- | 381 | continue; |
|
- | 382 | } |
|
- | 383 | ||
- | 384 | if (ch == U_END_ARROW) { |
|
- | 385 | /* End */ |
|
- | 386 | printf("%ls", current + position); |
|
- | 387 | position = wstr_length(current); |
|
- | 388 | continue; |
|
- | 389 | } |
|
- | 390 | ||
- | 391 | if (ch == U_DELETE) { |
|
- | 392 | /* Delete */ |
|
- | 393 | if (position == wstr_length(current)) |
|
- | 394 | continue; |
|
- | 395 | ||
- | 396 | if (wstr_remove(current, position)) { |
|
- | 397 | printf("%ls ", current + position); |
|
- | 398 | print_cc('\b', wstr_length(current) - position + 1); |
|
395 | } |
399 | } |
396 | continue; |
400 | continue; |
397 | } |
401 | } |
398 | 402 | ||
399 | if (wstr_linsert(current, ch, position, MAX_CMDLINE)) { |
403 | if (wstr_linsert(current, ch, position, MAX_CMDLINE)) { |