Rev 4267 | Rev 4297 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4267 | Rev 4273 | ||
---|---|---|---|
Line 300... | Line 300... | ||
300 | } |
300 | } |
301 | 301 | ||
302 | if (found == 0) |
302 | if (found == 0) |
303 | continue; |
303 | continue; |
304 | 304 | ||
- | 305 | if (found > 1) { |
|
- | 306 | /* No unique hint, list was printed */ |
|
- | 307 | printf("%s> ", prompt); |
|
- | 308 | printf("%ls", current); |
|
- | 309 | print_cc('\b', wstr_length(current) - position); |
|
- | 310 | continue; |
|
- | 311 | } |
|
- | 312 | ||
- | 313 | /* We have a hint */ |
|
- | 314 | ||
305 | size_t off = 0; |
315 | size_t off = 0; |
306 | count_t i = 0; |
316 | count_t i = 0; |
307 | while ((ch = str_decode(tmp, &off, STR_NO_LIMIT)) != 0) { |
317 | while ((ch = str_decode(tmp, &off, STR_NO_LIMIT)) != 0) { |
308 | if (!wstr_linsert(current, ch, position + i, MAX_CMDLINE)) |
318 | if (!wstr_linsert(current, ch, position + i, MAX_CMDLINE)) |
309 | break; |
319 | break; |
310 | i++; |
320 | i++; |
311 | } |
321 | } |
312 | 322 | ||
313 | if ((str_length(tmp) > 0) || (found == 1)) { |
- | |
314 | /* We have a hint */ |
- | |
315 | printf("%ls", current + position); |
323 | printf("%ls", current + position); |
316 | print_cc('\b', wstr_length(current) - position); |
324 | position += str_length(tmp); |
317 | position += str_length(tmp); |
325 | print_cc('\b', wstr_length(current) - position); |
318 | 326 | ||
319 | if ((found == 1) && (position == wstr_length(current))) { |
327 | if (position == wstr_length(current)) { |
- | 328 | /* Insert a space after the last completed argument */ |
|
320 | if (wstr_linsert(current, ' ', position, MAX_CMDLINE)) { |
329 | if (wstr_linsert(current, ' ', position, MAX_CMDLINE)) { |
321 | printf("%ls", current + position); |
330 | printf("%ls", current + position); |
322 | position++; |
331 | position++; |
323 | } |
- | |
324 | } |
332 | } |
325 | } else { |
- | |
326 | /* No unique hint, list was printed */ |
- | |
327 | printf("%s> ", prompt); |
- | |
328 | printf("%ls", current); |
- | |
329 | position += str_length(tmp); |
- | |
330 | } |
333 | } |
331 | - | ||
332 | print_cc('\b', wstr_length(current) - position); |
- | |
333 | continue; |
334 | continue; |
334 | } |
335 | } |
335 | 336 | ||
336 | if (ch == U_LEFT_ARROW) { |
337 | if (ch == U_LEFT_ARROW) { |
337 | /* Left */ |
338 | /* Left */ |