office: say exactly what to do next; l opens lazygit and t opens the tool chooser everywhere; a remote run gets a terminal to ask in
This commit is contained in:
@@ -52,8 +52,10 @@ type projectModel struct {
|
||||
err error
|
||||
readAt time.Time
|
||||
|
||||
git gitState
|
||||
wts []worktreeRow
|
||||
git gitState
|
||||
wts []worktreeRow
|
||||
tools bool
|
||||
toolAt int
|
||||
|
||||
tab int
|
||||
scroll int
|
||||
@@ -168,6 +170,25 @@ func (m projectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
return m, tea.Batch(m.load(), tickEvery(10*time.Second))
|
||||
|
||||
case tea.KeyMsg:
|
||||
// The tool chooser owns every key while it is open, before the
|
||||
// confirmation dialogs and before the tabs.
|
||||
if m.tools {
|
||||
key := msg.String()
|
||||
if key == "esc" || key == "q" || key == "t" {
|
||||
m.tools = false
|
||||
return m, nil
|
||||
}
|
||||
if consumed, chosen := toolPickerKeys(key, &m.toolAt); consumed {
|
||||
if chosen != "" {
|
||||
m.tools = false
|
||||
if err := openTool(m.folder, chosen); err != nil {
|
||||
m.err = err
|
||||
}
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
if m.confirmSwitch {
|
||||
switch msg.String() {
|
||||
case "y":
|
||||
@@ -204,8 +225,11 @@ func (m projectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
case "r":
|
||||
return m, m.load()
|
||||
case "t":
|
||||
// lazygit, in the project folder: it is the tool that can stage,
|
||||
// exclude and commit. Nothing here reimplements it.
|
||||
m.tools = true
|
||||
return m, nil
|
||||
case "l":
|
||||
// lazygit in the project folder: the tool that stages, excludes and
|
||||
// commits. `t` is the chooser, as it is on every other pane.
|
||||
if err := openTool(m.folder, "lazygit"); err != nil {
|
||||
m.err = err
|
||||
}
|
||||
@@ -224,13 +248,13 @@ func (m projectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
}
|
||||
}
|
||||
return m, nil
|
||||
case "(", "[", "h":
|
||||
case "(", "[":
|
||||
if m.tab > 0 {
|
||||
m.tab--
|
||||
m.scroll = 0
|
||||
}
|
||||
return m, nil
|
||||
case ")", "]", "l", "tab":
|
||||
case ")", "]", "tab":
|
||||
if m.tab < len(projectTabs)-1 {
|
||||
m.tab++
|
||||
m.scroll = 0
|
||||
@@ -289,10 +313,14 @@ func (m projectModel) View() string {
|
||||
{"esc or n", "stay here"},
|
||||
}, m.width, m.height)
|
||||
}
|
||||
if m.tools {
|
||||
return toolMenu(m.toolAt, m.width, m.height)
|
||||
}
|
||||
if m.showHelp {
|
||||
return helpOverlay("the project", [][2]string{
|
||||
{"( )", "overview, git, facts, costs, settings, projects"},
|
||||
{"t", "open lazygit in this folder"},
|
||||
{"t", "open a tool pane here (lazygit, yazi, nvim, …)"},
|
||||
{"l", "lazygit, straight away"},
|
||||
{"[ ] h l", "previous and next tab"},
|
||||
{"↑ ↓ j k", "scroll"},
|
||||
{"r", "read again"},
|
||||
@@ -344,7 +372,8 @@ func (m projectModel) View() string {
|
||||
|
||||
footer := hintLine([]string{
|
||||
keyHint("( )", "tab"),
|
||||
keyHint("t", "lazygit"),
|
||||
keyHint("t", "tools"),
|
||||
keyHint("l", "lazygit"),
|
||||
keyHint("↑↓", "scroll"),
|
||||
keyHint("r", "refresh"),
|
||||
keyHint("R", "rebuild"),
|
||||
|
||||
Reference in New Issue
Block a user