mattwparas / helix-config

34 stars 2 forks source link

Can't get Terminal Working #8

Closed Talia-12 closed 1 month ago

Talia-12 commented 1 month ago

Thank you for the work you've done getting the plugin system this functional.

I'm having an issue with the term.scm plugin you provide here that I can't figure out how to debug (especially as this is my first time touching Steel or any lisp). The error message that's being thrown is not incredibly helpful.

image

If there's more you want me to look into to troubleshoot I'm happy to do that

below is the diff between your term.scm and mine, mostly consisting of an attempt to swap from xlpr to lf:

2d1
< 
4d2
< (require "steel/logging/log.scm")
57d54
<          hide-term
65c62
<          lf
---
>          xplr
80c77
< (define *default-shell* "<<default-shell>>")
---
> (define *default-shell* "/usr/bin/zsh")
169,170d165
<   (log/info! . "Making a new terminal.")
<   
174,175d168
<   (log/info! . ("Made a new terminal" *pty-process*))
< 
209,210c202,203
<     ;; other use cases (like launching something like lf)
<     ;; we might want to go straight in to lf.
---
>     ;; other use cases (like launching something like xplr)
>     ;; we might want to go straight in to xplr.
706,707c699,700
<     ;; other use cases (like launching something like lf)
<     ;; we might want to go straight in to lf.
---
>     ;; other use cases (like launching something like xplr)
>     ;; we might want to go straight in to xplr.
783,796d775
< ;; Hide the terminal without killing it
< (define (hide-term)
<   (define cursor (TerminalRegistry-cursor *terminal-registry*))
< 
<   ;; Only hide the terminal if a terminal exists
<   (cond
<     [cursor
<       (define term (list-ref (TerminalRegistry-terminals *terminal-registry*) cursor))
< 
<       (set-box! (Terminal-focused? term) #f)
<       (set-box! (Terminal-active term) #f)
<       (pop-last-component! (Terminal-name term))]))
< 
< ;;@doc
842c821
<     (show-term (list-ref (TerminalRegistry-terminals *terminal-registry*) (TerminalRegistry-cursor *terminal-registry*)))))
---
>     (show-term (list-ref (TerminalRegistry-terminals *terminal-registry*) (+ 1 cursor)))))
900c879
< ;;;;; lf file picker ;;;;;;
---
> ;;;;; Xplr file picker ;;;;;;
907c886
< (define (lf-event-handler state event)
---
> (define (xplr-event-handler state event)
997c976
< (define *lf* #f)
---
> (define *xplr* #f)
999c978
< (define (make-lf shell rows cols)
---
> (define (make-xplr shell rows cols)
1006c985
<   (pty-process-send-command *pty-process* (string-append "cd " (helix-find-workspace) "; lf\r"))
---
>   (pty-process-send-command *pty-process* (string-append "cd " (helix-find-workspace) " && xplr\r"))
1008c987
<   (let ([terminal (Terminal "lf"
---
>   (let ([terminal (Terminal "xplr"
1030c1009
<                             lf-event-handler
---
>                             xplr-event-handler
1036c1015
<     (lf-loop terminal)
---
>     (xplr-loop terminal)
1040c1019
< (define (lf-loop term)
---
> (define (xplr-loop term)
1044c1023
<   (define (lf-loop-inner)
---
>   (define (xplr-loop-inner)
1066c1045
<                                          (pop-last-component! "lf")))
---
>                                          (pop-last-component! "xplr")))
1073c1052
<                                       ; (pop-last-component! "lf")
---
>                                       ; (pop-last-component! "xplr")
1084c1063
<                                       (lf-loop-inner))))))))
---
>                                       (xplr-loop-inner))))))))
1086c1065
<   (lf-loop-inner))
---
>   (xplr-loop-inner))
1088,1089c1067,1068
< (define (lf)
<   ;; Set the lf width and height
---
> (define (xplr)
>   ;; Set the xplr width and height
1091,1092c1070,1071
<   (define new-term (make-lf *default-shell* *default-terminal-rows* *default-terminal-cols*))
<   (set! *lf* new-term)
---
>   (define new-term (make-xplr *default-shell* *default-terminal-rows* *default-terminal-cols*))
>   (set! *xplr* new-term)
1095,1098c1074,1077
< (define (close-lf)
<   (when *lf*
<     (stop-terminal *lf*)
<     (set! *lf* #f)))
---
> (define (close-xplr)
>   (when *xplr*
>     (stop-terminal *xplr*)
>     (set! *xplr* #f)))
mattwparas commented 1 month ago

What is your environment? Which shell are you using? This is the result when opening up lf?

Talia-12 commented 1 month ago

huh okay so plausibly I should have tested swapping terminals sooner. My default is nushell, which was resulting in the assertion error above when running either :open-term or :lf. Swapping over to bash (i.e. (define default-shell "bash")) has resulted in the terminal working fine, even allowing running nushell from bash.

...and in fact after checking further I was pointing the default shell at the nushell package directory rather than the binary inside, whoops.