diff --git a/README.md b/README.md index 4ea9d9b..68873af 100644 --- a/README.md +++ b/README.md @@ -87,9 +87,9 @@ The layout is defined by a sequence of operations as a layout command. The layout editor allows users to interactively input their commands and shows the resulting layouts on screen, with the following auxiliary functions: 1. `Up`/`Down`: restore to the history command -2. `Backspace`: undo the last command. If the command is already empty, restores to the current (maybe transcoded) command of the layout. +2. `Backspace`: undo the last command. If `Shift` is hold, restores to the current (maybe transcoded) command of the layout. 3. `Escape`: exit the editor without saving the layout. -4. `Enter`: when all areas are defined, hit enter will save the layout. If shift is hold, only applies the command without saving it to the history. +4. `Enter`: when all areas are defined, hit enter will save the layout. If `Shift` is hold, only applies the command without saving it to the history. ### Layout command diff --git a/editor.lua b/editor.lua index ec9b717..53e152d 100644 --- a/editor.lua +++ b/editor.lua @@ -369,11 +369,18 @@ function module.create(data) local ok, err = pcall( function () if key == "BackSpace" then - if #current_cmd > 0 then - set_cmd(current_cmd:sub(1, #current_cmd - 1)) - elseif embed_args == nil then + local alt = false + for _, m in ipairs(mod) do + if m == "Shift" then + alt = true + break + end + end + if alt then local areas = layout.machi_get_areas(screen, tag) set_cmd(machi_engine.areas_to_command(areas)) + else + set_cmd(current_cmd:sub(1, #current_cmd - 1)) end elseif key == "Escape" then table.remove(data.cmds, #data.cmds)