Rev 603 | Rev 607 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 603 | Rev 606 | ||
---|---|---|---|
Line 236... | Line 236... | ||
236 | 236 | ||
237 | char tmp[MAX_CMDLINE+1]; |
237 | char tmp[MAX_CMDLINE+1]; |
238 | int curlen = 0, position = 0; |
238 | int curlen = 0, position = 0; |
239 | char *current = history[histposition]; |
239 | char *current = history[histposition]; |
240 | int i; |
240 | int i; |
- | 241 | char mod; /* Command Modifier */ |
|
241 | char c; |
242 | char c; |
242 | 243 | ||
243 | printf("%s> ", prompt); |
244 | printf("%s> ", prompt); |
244 | while (1) { |
245 | while (1) { |
245 | c = _getc(input); |
246 | c = _getc(input); |
Line 307... | Line 308... | ||
307 | } |
308 | } |
308 | rdln_print_c('\b', curlen-position); |
309 | rdln_print_c('\b', curlen-position); |
309 | continue; |
310 | continue; |
310 | } |
311 | } |
311 | if (c == 0x1b) { |
312 | if (c == 0x1b) { |
- | 313 | mod = _getc(input); |
|
312 | c = _getc(input); |
314 | c = _getc(input); |
- | 315 | ||
313 | if (c!= 0x5b) |
316 | if (mod != 0x5b && mod != 0x4f) |
314 | continue; |
317 | continue; |
- | 318 | ||
- | 319 | if (c == 0x33 && _getc(input) == 0x7e) { |
|
- | 320 | if (position == curlen) |
|
315 | c = _getc(input); |
321 | continue; |
- | 322 | for (i=position+1; i<curlen;i++) { |
|
- | 323 | putchar(current[i]); |
|
- | 324 | current[i-1] = current[i]; |
|
- | 325 | } |
|
- | 326 | putchar(' '); |
|
- | 327 | rdln_print_c('\b',curlen-position); |
|
- | 328 | curlen--; |
|
- | 329 | } |
|
- | 330 | else if (c == 0x48) { /* Home */ |
|
- | 331 | rdln_print_c('\b',position); |
|
- | 332 | position = 0; |
|
- | 333 | } |
|
- | 334 | else if (c == 0x46) { |
|
- | 335 | for (i=position;i<curlen;i++) |
|
- | 336 | putchar(current[i]); |
|
- | 337 | position = curlen; |
|
- | 338 | } |
|
316 | if (c == 0x44) { /* Left */ |
339 | else if (c == 0x44) { /* Left */ |
317 | if (position > 0) { |
340 | if (position > 0) { |
318 | putchar('\b'); |
341 | putchar('\b'); |
319 | position--; |
342 | position--; |
320 | } |
343 | } |
321 | continue; |
344 | continue; |
322 | } |
345 | } |
323 | if (c == 0x43) { /* Right */ |
346 | else if (c == 0x43) { /* Right */ |
324 | if (position < curlen) { |
347 | if (position < curlen) { |
325 | putchar(current[position]); |
348 | putchar(current[position]); |
326 | position++; |
349 | position++; |
327 | } |
350 | } |
328 | continue; |
351 | continue; |
329 | } |
352 | } |
330 | if (c == 0x41 || c == 0x42) { /* Up,down */ |
353 | else if (c == 0x41 || c == 0x42) { |
- | 354 | /* Up,down */ |
|
331 | rdln_print_c('\b',position); |
355 | rdln_print_c('\b',position); |
332 | rdln_print_c(' ',curlen); |
356 | rdln_print_c(' ',curlen); |
333 | rdln_print_c('\b',curlen); |
357 | rdln_print_c('\b',curlen); |
334 | if (c == 0x41) |
358 | if (c == 0x41) |
335 | histposition--; |
359 | histposition--; |