emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/inf-ruby 7dfc779dc6: #161 Handle multiline eval results


From: ELPA Syncer
Subject: [nongnu] elpa/inf-ruby 7dfc779dc6: #161 Handle multiline eval results
Date: Wed, 3 Aug 2022 20:58:41 -0400 (EDT)

branch: elpa/inf-ruby
commit 7dfc779dc6038125c516c7c7746994a54b96e409
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    #161 Handle multiline eval results
---
 inf-ruby.el | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/inf-ruby.el b/inf-ruby.el
index 541064f5af..226a72647f 100755
--- a/inf-ruby.el
+++ b/inf-ruby.el
@@ -579,12 +579,12 @@ the overlay."
                      0 (length display-string)
                      'face prepend-face
                      display-string)
-            ;; If the display spans multiple lines or is very long, display it 
at
-            ;; the beginning of the next line.
-            (when (or (string-match "\n." display-string)
-                      (> (string-width display-string)
-                        (- (window-width) (current-column))))
-              (setq display-string (concat " \n" display-string)))
+            ;; ;; If the display spans multiple lines or is very long, display 
it at
+            ;; ;; the beginning of the next line.
+            ;; (when (or (string-match "\n." display-string)
+            ;;           (> (string-width display-string)
+            ;;              (- (window-width) (current-column))))
+            ;;   (setq display-string (concat " \n" display-string)))
             ;; Put the cursor property only once we're done manipulating the
             ;; string, since we want it to be at the first char.
             (put-text-property 0 1 'cursor 0 display-string)
@@ -653,7 +653,17 @@ This function also removes itself from `pre-command-hook'."
             (while (string-match inf-ruby-prompt-pattern s)
               (setq s (replace-match "" t t s)))
             (error "%s" s)))
-      (buffer-substring-no-properties (point) (line-end-position)))))
+      (if (looking-at " *$")
+          (progn
+            (goto-char (1+ (match-end 0)))
+            (replace-regexp-in-string
+             "\n +" " "
+             (buffer-substring-no-properties
+              (point)
+              (progn
+                (forward-sexp)
+                (point)))))
+        (buffer-substring-no-properties (point) (line-end-position))))))
 
 (defun ruby-send-definition ()
   "Send the current definition to the inferior Ruby process."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]