diff options
author | Joe <rbo@gmx.us> | 2024-04-25 20:20:20 +0200 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-04-25 20:20:20 +0200 |
commit | 72ee87d8c097449a315b476f0b359ae6c44c26cf (patch) | |
tree | 122153aa21ae063b9c3a1692ee95aab2f90ed42a /src/i_insert.go | |
parent | goot test (diff) | |
download | hardflip-72ee87d8c097449a315b476f0b359ae6c44c26cf.tar.gz hardflip-72ee87d8c097449a315b476f0b359ae6c44c26cf.tar.bz2 hardflip-72ee87d8c097449a315b476f0b359ae6c44c26cf.tar.xz hardflip-72ee87d8c097449a315b476f0b359ae6c44c26cf.tar.zst hardflip-72ee87d8c097449a315b476f0b359ae6c44c26cf.zip |
wo edit was fast
Diffstat (limited to '')
-rw-r--r-- | src/i_insert.go | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/i_insert.go b/src/i_insert.go index ce08ebc..0bb55a8 100644 --- a/src/i_insert.go +++ b/src/i_insert.go @@ -138,9 +138,15 @@ func i_insert_host(data *HardData, insert *HostNode) { if len(insert.Drive) == 0 { insert.Drive = nil } - filename := i_insert_format_filename(insert.Name, - data.data_dir + insert.parent.path()) - insert.filename = filename + filename := insert.filename + replace := false + if len(filename) == 0 || data.yank != nil { + filename = i_insert_format_filename(insert.Name, + data.data_dir + insert.parent.path()) + insert.filename = filename + } else { + replace = true + } fmt, err := yaml.Marshal(insert) if err != nil { c_error_mode("yaml", err, &data.ui) @@ -154,6 +160,14 @@ func i_insert_host(data *HardData, insert *HostNode) { data.insert = nil return } + if replace == true && data.litems.curr != nil { + tmp := e_deep_copy_host(data.insert) + data.litems.curr.Host = &tmp + data.litems.reset_id() + data.ui.mode = NORMAL_MODE + data.insert = nil + return + } // HACK: not sure if this is necessary // if data.litems.curr.is_dir() == true { // data.litems.curr.Dirs.lhost.add_back(insert) |