From 7391b11e457ffd09626b06b39c8a3db97a805a8a Mon Sep 17 00:00:00 2001 From: Anton Medvedev Date: Mon, 25 Sep 2023 21:56:32 +0200 Subject: [PATCH] Replace gid input with current path only if cursor at the end --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index af49734..3d7057a 100644 --- a/main.go +++ b/main.go @@ -291,8 +291,10 @@ func (m *model) handleDigKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) { default: if key.Matches(msg, key.NewBinding(key.WithKeys("."))) { - m.digInput.SetValue(m.cursorPath()) - m.digInput.CursorEnd() + if m.digInput.Position() == len(m.digInput.Value()) { + m.digInput.SetValue(m.cursorPath()) + m.digInput.CursorEnd() + } } m.digInput, cmd = m.digInput.Update(msg)