Mercurial > emacs
comparison lisp/comint.el @ 31581:e4d30cac5296
(comint-output-filter):
Revert to using `insert-before-markers'.
Add bletcherous hack to undo damage caused by `insert-before-markers'.
Put `front-sticky' property on overlays created here so that the field code
understands how the overlay works.
Use a let when making comint-last-prompt-overlay, so that the code is
easier to read.
author | Miles Bader <miles@gnu.org> |
---|---|
date | Wed, 13 Sep 2000 12:04:55 +0000 |
parents | f7d9dca2541e |
children | ebe991a7d6f9 |
comparison
equal
deleted
inserted
replaced
31580:ceb9089df57d | 31581:e4d30cac5296 |
---|---|
1508 (widen) | 1508 (widen) |
1509 | 1509 |
1510 (goto-char (process-mark process)) | 1510 (goto-char (process-mark process)) |
1511 (set-marker comint-last-output-start (point)) | 1511 (set-marker comint-last-output-start (point)) |
1512 | 1512 |
1513 (insert string) | 1513 ;; insert-before-markers is a bad thing. XXX |
1514 | 1514 ;; |
1515 ;; It is used here to force window-point markers (used to | |
1516 ;; store the value of point in non-selected windows) to | |
1517 ;; advance, but it also screws up any other markers that we | |
1518 ;; don't _want_ to advance, such as the start-marker of some | |
1519 ;; of the overlays we create. | |
1520 ;; | |
1521 ;; We work around the problem with the overlays by | |
1522 ;; explicitly adjusting them after we do the insertion, but | |
1523 ;; in the future this problem should be solved correctly, by | |
1524 ;; using `insert', and making the insertion-type of | |
1525 ;; window-point markers settable (via a buffer-local | |
1526 ;; variable). In comint buffers, this variable would be set | |
1527 ;; to `t', to cause point in non-select windows to advance. | |
1528 (insert-before-markers string) | |
1529 ;; Fixup markers and overlays that got screwed up because we | |
1530 ;; used `insert-before-markers'. | |
1531 (let ((old-point (- (point) (length string)))) | |
1532 ;; comint-last-output-start marker | |
1533 (set-marker comint-last-output-start old-point) | |
1534 ;; No overlays we create are set to advance upon insertion | |
1535 ;; (at the start/end), so we assume that any overlay which | |
1536 ;; is at the current point was incorrectly advanced by | |
1537 ;; insert-before-markers. First fixup overlays that might | |
1538 ;; start at point: | |
1539 (dolist (over (overlays-at (point))) | |
1540 (when (= (overlay-start over) (point)) | |
1541 (let ((end (overlay-end over))) | |
1542 (move-overlay over | |
1543 old-point | |
1544 (if (= end (point)) old-point end))))) | |
1545 ;; Then do overlays that might end at point: | |
1546 (dolist (over (overlays-at (1- (point)))) | |
1547 (when (= (overlay-end over) (point)) | |
1548 (move-overlay over | |
1549 (min (overlay-start over) old-point) | |
1550 old-point)))) | |
1551 | |
1552 ;; Advance process-mark | |
1515 (set-marker (process-mark process) (point)) | 1553 (set-marker (process-mark process) (point)) |
1516 | 1554 |
1517 (unless comint-use-prompt-regexp-instead-of-fields | 1555 (unless comint-use-prompt-regexp-instead-of-fields |
1518 ;; We check to see if the last overlay used for output is | 1556 ;; We check to see if the last overlay used for output is |
1519 ;; adjacent to the new input, and if so, just extend it. | 1557 ;; adjacent to the new input, and if so, just extend it. |
1526 (overlay-start comint-last-output-overlay) | 1564 (overlay-start comint-last-output-overlay) |
1527 (point)) | 1565 (point)) |
1528 ;; Create a new overlay | 1566 ;; Create a new overlay |
1529 (let ((over (make-overlay comint-last-output-start (point)))) | 1567 (let ((over (make-overlay comint-last-output-start (point)))) |
1530 (overlay-put over 'field 'output) | 1568 (overlay-put over 'field 'output) |
1569 (overlay-put over 'inhibit-line-move-field-capture t) | |
1570 (overlay-put over 'front-sticky t) | |
1531 (overlay-put over 'rear-nonsticky t) | 1571 (overlay-put over 'rear-nonsticky t) |
1532 (overlay-put over 'inhibit-line-move-field-capture t) | |
1533 (overlay-put over 'evaporate t) | 1572 (overlay-put over 'evaporate t) |
1534 (setq comint-last-output-overlay over)))) | 1573 (setq comint-last-output-overlay over)))) |
1535 | 1574 |
1536 (when comint-highlight-prompt | 1575 (when comint-highlight-prompt |
1537 ;; Highlight the prompt, where we define `prompt' to mean | 1576 ;; Highlight the prompt, where we define `prompt' to mean |
1544 (if comint-last-prompt-overlay | 1583 (if comint-last-prompt-overlay |
1545 ;; Just move an existing overlay | 1584 ;; Just move an existing overlay |
1546 (move-overlay comint-last-prompt-overlay | 1585 (move-overlay comint-last-prompt-overlay |
1547 prompt-start (point)) | 1586 prompt-start (point)) |
1548 ;; Need to create the overlay | 1587 ;; Need to create the overlay |
1549 (setq comint-last-prompt-overlay | 1588 (let ((over (make-overlay prompt-start (point)))) |
1550 (make-overlay prompt-start (point))) | 1589 (overlay-put over 'face 'comint-highlight-prompt-face) |
1551 (overlay-put comint-last-prompt-overlay | 1590 (overlay-put over 'front-sticky t) |
1552 'rear-nonsticky t) | 1591 (overlay-put over 'rear-nonsticky t) |
1553 (overlay-put comint-last-prompt-overlay | 1592 (setq comint-last-prompt-overlay over)))))) |
1554 'face 'comint-highlight-prompt-face))))) | |
1555 | 1593 |
1556 ;;(force-mode-line-update) | 1594 ;;(force-mode-line-update) |
1557 | 1595 |
1558 (goto-char saved-point) | 1596 (goto-char saved-point) |
1559 | 1597 |