-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: vt integration & lazygit #1608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
aa057b7 to
1f5680b
Compare
b0576a6 to
0456f77
Compare
| OpenReasoningDialogMsg struct{} | ||
| OpenExternalEditorMsg struct{} | ||
| ToggleYoloModeMsg struct{} | ||
| OpenLazygitMsg struct{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of making this hardcoded, uses should define their commands in the config and Crush should load the list of defined termdialog commands
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially we want to only setup some known integrations and we will add the config later.
|
|
||
| // Add lazygit command if lazygit is installed. | ||
| sh := shell.NewShell(nil) | ||
| if _, _, err := sh.Exec(c.ctx, "which lazygit"); err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is bad. Exec should be able to look for the binary in $PATH automatically. Otherwise, you should be using exec.LookPath
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to use the shell we use for the bash scripts but I can change this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, let's make this configurable in the json instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially we want to only setup some known integrations and we will add the config later.
|
|
||
| ctx context.Context | ||
| pty xpty.Pty | ||
| vterm *vt.Emulator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep in mind that vt is still missing some important VT features that might affect the output for some commands
| } | ||
| return d, d.term.RefreshCmd() | ||
|
|
||
| case tea.KeyPressMsg: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The vt library might not handle certain Kitty enhanced keyboard keys because it doesn't implement that yet.
| return d, nil | ||
| } | ||
|
|
||
| func (d *Dialog) handleResize(msg tea.WindowSizeMsg) (util.Model, tea.Cmd) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might break when the VT resize ends up with the cursor outside the screen. VT doesn't handle these cases nor wrapping the cursor on resize yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this not already clamping the cursor ? https://github.com/charmbracelet/x/blob/main/vt/emulator.go#L217
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should flow the cursor instead of clamping it. For example, when a screen gets narrow and increase in height where the cursor can no longer fits the width of the screen, it should flow to the next lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh I think we can def improve on this, but its good enough for an initial release.
|
This will need to be re-implemented for the new UI. |
You can now use lazygit inside of crush.
lazygit.mp4