Skip to content

Commit

Permalink
fix: dont reset dir if not moving
Browse files Browse the repository at this point in the history
  • Loading branch information
mistakenelf committed Mar 23, 2024
1 parent e0dce84 commit e629e0d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/tui/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
cmds = append(cmds, m.image.SetSizeCmd(halfSize, height))
cmds = append(cmds, m.markdown.SetSizeCmd(halfSize, height))

m.filetree.SetSize(halfSize, height)
m.filetree.SetSize(halfSize, height-3)
m.secondaryFiletree.SetSize(halfSize, height)
m.help.SetSize(halfSize, height)
m.code.SetSize(halfSize, height)
Expand All @@ -41,6 +41,10 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
cmds = append(cmds, m.openFileCmd())
}
case key.Matches(msg, m.keyMap.ResetState):
if m.state == showMoveState {
cmds = append(cmds, m.filetree.GetDirectoryListingCmd(m.directoryBeforeMove))
}

m.state = idleState
m.showTextInput = false
m.disableAllViewports()
Expand All @@ -53,8 +57,6 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.textinput, cmd = m.textinput.Update(msg)
cmds = append(cmds, cmd)

cmds = append(cmds, m.filetree.GetDirectoryListingCmd(m.directoryBeforeMove))

m.textinput.Reset()
case key.Matches(msg, m.keyMap.MoveDirectoryItem):
m.directoryBeforeMove = m.filetree.GetSelectedItem().CurrentDirectory
Expand Down

0 comments on commit e629e0d

Please sign in to comment.