Handle carriage return in inf-ruby output
Added a custom function `inf-ruby-process-carriage-return` to clean up unwanted carriage returns from inf-ruby output. This function is now hooked into `comint-preoutput-filter-functions` to process output in `inf-ruby-mode`. This change ensures better handling of newline characters in the output stream.
This commit is contained in:
parent
1327019fdb
commit
f9a67dde68
@ -18,7 +18,16 @@
|
||||
:commands (inf-ruby inf-ruby-console-auto)
|
||||
:general
|
||||
([remap inf-ruby] #'inf-ruby-console-auto)
|
||||
:hook (after-init . inf-ruby-switch-setup))
|
||||
:hook (after-init . inf-ruby-switch-setup)
|
||||
:config
|
||||
(defun inf-ruby-process-carriage-return (output)
|
||||
(let ((processed (replace-regexp-in-string ".*\r" "" output)))
|
||||
(if (string-match-p "\\`\n" processed)
|
||||
(replace-regexp-in-string "\\`\n" "" processed)
|
||||
processed)))
|
||||
(defun inf-ruby-carriage-return-hook ()
|
||||
(add-hook 'comint-preoutput-filter-functions #'inf-ruby-process-carriage-return nil t))
|
||||
(add-hook 'inf-ruby-mode-hook #'inf-ruby-carriage-return-hook))
|
||||
|
||||
(use-package rbenv
|
||||
:hook (after-init . global-rbenv-mode)
|
||||
|
Loading…
Reference in New Issue
Block a user