branch: externals/dape
commit 00761f56142dc2219444f815fc7977bc8c4898b6
Author: Daniel Pettersson <dan...@dpettersson.net>
Commit: Daniel Pettersson <dan...@dpettersson.net>

    Apply comint filter before echoing shell to repl
---
 dape.el | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/dape.el b/dape.el
index 2cd63a92a9..531f1257fb 100644
--- a/dape.el
+++ b/dape.el
@@ -1935,12 +1935,16 @@ Starts a new adapter CONNs from ARGUMENTS."
                                (list shell-file-name shell-command-switch
                                      (mapconcat #'identity args " "))
                              args))
-                         :filter (if dape-repl-echo-shell-output
-                                     (lambda (process string)
-                                       (dape--repl-insert string)
-                                       (comint-output-filter process string))
-                                   #'comint-output-filter)
-                         :sentinel 'shell-command-sentinel
+                         :filter
+                         (if dape-repl-echo-shell-output
+                             (lambda (process string)
+                               (let ((before (marker-position (process-mark 
process))))
+                                 (comint-output-filter process string)
+                                 (dape--repl-insert
+                                  (with-current-buffer (process-buffer process)
+                                    (buffer-substring before (process-mark 
process))))))
+                           #'comint-output-filter)
+                         :sentinel #'shell-command-sentinel
                          :file-handler t)))
       (unless dape-repl-echo-shell-output (dape--display-buffer buffer))
       (list :processId (process-id process)))))

Reply via email to