diff options
| author | Richard M. Stallman | 1994-11-13 19:57:12 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-11-13 19:57:12 +0000 |
| commit | 681f5af46e207240f51432cb07dd8eb4f4bfdcf1 (patch) | |
| tree | 53a2e6f1e41bacc07d8a75ab0b471639c8982bbe | |
| parent | 7812a96f4bdecafb2635439ea3f09037a51aef43 (diff) | |
| download | emacs-681f5af46e207240f51432cb07dd8eb4f4bfdcf1.tar.gz emacs-681f5af46e207240f51432cb07dd8eb4f4bfdcf1.zip | |
(Fdisplay_completion_list): Update COLUMN unconditionally.
If a name is long, put it on its own line.
| -rw-r--r-- | src/minibuf.c | 82 |
1 files changed, 55 insertions, 27 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index bd0b4c2c404..7ca45ecad76 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -1432,6 +1432,7 @@ It can find the completion buffer in `standard-output'.") | |||
| 1432 | int column = 0; | 1432 | int column = 0; |
| 1433 | struct gcpro gcpro1; | 1433 | struct gcpro gcpro1; |
| 1434 | struct buffer *old = current_buffer; | 1434 | struct buffer *old = current_buffer; |
| 1435 | int first = 1; | ||
| 1435 | 1436 | ||
| 1436 | /* Note that (when it matters) every variable | 1437 | /* Note that (when it matters) every variable |
| 1437 | points to a non-string that is pointed to by COMPLETIONS. */ | 1438 | points to a non-string that is pointed to by COMPLETIONS. */ |
| @@ -1448,14 +1449,49 @@ It can find the completion buffer in `standard-output'.") | |||
| 1448 | write_string ("Possible completions are:", -1); | 1449 | write_string ("Possible completions are:", -1); |
| 1449 | for (tail = completions, i = 0; !NILP (tail); tail = Fcdr (tail), i++) | 1450 | for (tail = completions, i = 0; !NILP (tail); tail = Fcdr (tail), i++) |
| 1450 | { | 1451 | { |
| 1451 | /* this needs fixing for the case of long completions | 1452 | Lisp_Object tem; |
| 1452 | and/or narrow windows */ | 1453 | int length; |
| 1453 | /* Sadly, the window it will appear in is not known | 1454 | |
| 1454 | until after the text has been made. */ | 1455 | elt = Fcar (tail); |
| 1455 | if (i & 1) | 1456 | /* Compute the length of this element. */ |
| 1457 | if (CONSP (elt)) | ||
| 1458 | { | ||
| 1459 | tem = Fcar (elt); | ||
| 1460 | CHECK_STRING (tem, 0); | ||
| 1461 | length = XINT (XSTRING (tem)->size); | ||
| 1462 | |||
| 1463 | tem = Fcar (Fcdr (elt)); | ||
| 1464 | CHECK_STRING (tem, 0); | ||
| 1465 | length += XINT (XSTRING (tem)->size); | ||
| 1466 | } | ||
| 1467 | else | ||
| 1468 | { | ||
| 1469 | CHECK_STRING (elt, 0); | ||
| 1470 | length = XINT (XSTRING (elt)->size); | ||
| 1471 | } | ||
| 1472 | |||
| 1473 | /* This does a bad job for narrower than usual windows. | ||
| 1474 | Sadly, the window it will appear in is not known | ||
| 1475 | until after the text has been made. */ | ||
| 1476 | |||
| 1477 | /* If the previous completion was very wide, | ||
| 1478 | or we have two on this line already, | ||
| 1479 | don't put another on the same line. */ | ||
| 1480 | if (column > 33 || first | ||
| 1481 | /* If this is really wide, don't put it second on a line. */ | ||
| 1482 | || column > 0 && length > 45) | ||
| 1483 | { | ||
| 1484 | Fterpri (Qnil); | ||
| 1485 | column = 0; | ||
| 1486 | } | ||
| 1487 | /* Otherwise advance to column 35. */ | ||
| 1488 | else | ||
| 1456 | { | 1489 | { |
| 1457 | if (BUFFERP (Vstandard_output)) | 1490 | if (BUFFERP (Vstandard_output)) |
| 1458 | Findent_to (make_number (35), make_number (2)); | 1491 | { |
| 1492 | tem = Findent_to (make_number (35), make_number (2)); | ||
| 1493 | column = XINT (tem); | ||
| 1494 | } | ||
| 1459 | else | 1495 | else |
| 1460 | { | 1496 | { |
| 1461 | do | 1497 | do |
| @@ -1466,35 +1502,27 @@ It can find the completion buffer in `standard-output'.") | |||
| 1466 | while (column < 35); | 1502 | while (column < 35); |
| 1467 | } | 1503 | } |
| 1468 | } | 1504 | } |
| 1469 | else | 1505 | |
| 1470 | { | 1506 | /* Output this element and update COLUMN. */ |
| 1471 | Fterpri (Qnil); | ||
| 1472 | column = 0; | ||
| 1473 | } | ||
| 1474 | elt = Fcar (tail); | ||
| 1475 | if (CONSP (elt)) | 1507 | if (CONSP (elt)) |
| 1476 | { | 1508 | { |
| 1477 | if (!BUFFERP (Vstandard_output)) | ||
| 1478 | { | ||
| 1479 | Lisp_Object tem; | ||
| 1480 | tem = Flength (Fcar (elt)); | ||
| 1481 | column += XINT (tem); | ||
| 1482 | tem = Flength (Fcar (Fcdr (elt))); | ||
| 1483 | column += XINT (tem); | ||
| 1484 | } | ||
| 1485 | Fprinc (Fcar (elt), Qnil); | 1509 | Fprinc (Fcar (elt), Qnil); |
| 1486 | Fprinc (Fcar (Fcdr (elt)), Qnil); | 1510 | Fprinc (Fcar (Fcdr (elt)), Qnil); |
| 1487 | } | 1511 | } |
| 1488 | else | 1512 | else |
| 1513 | Fprinc (elt, Qnil); | ||
| 1514 | |||
| 1515 | column += length; | ||
| 1516 | |||
| 1517 | /* If output is to a buffer, recompute COLUMN in a way | ||
| 1518 | that takes account of character widths. */ | ||
| 1519 | if (BUFFERP (Vstandard_output)) | ||
| 1489 | { | 1520 | { |
| 1490 | if (!BUFFERP (Vstandard_output)) | 1521 | tem = Fcurrent_column (); |
| 1491 | { | 1522 | column = XINT (tem); |
| 1492 | Lisp_Object tem; | ||
| 1493 | tem = Flength (elt); | ||
| 1494 | column += XINT (tem); | ||
| 1495 | } | ||
| 1496 | Fprinc (elt, Qnil); | ||
| 1497 | } | 1523 | } |
| 1524 | |||
| 1525 | first = 0; | ||
| 1498 | } | 1526 | } |
| 1499 | } | 1527 | } |
| 1500 | 1528 | ||