enhance s

This commit is contained in:
Xinhao Yuan 2019-07-04 23:35:59 -04:00
parent 4fc1d4d77b
commit 14d055c118
2 changed files with 4 additions and 4 deletions

View File

@ -33,7 +33,7 @@ Undefined parameters are (mostly) treated as 1.
1. `Up`/`Down`: restore to the history command sequence
2. `h`/`v`: split the current region horizontally/vertically into 2 regions. The split will respect the ratio A:B.
3. `w`: Take two parameters (A, B), and split the current region equally into A columns and B rows. If no parameter is defined, behave the same as `Space` without parameters.
4. `s`: shift the current editing region with other open sibling regions.
4. `s`: shift the current editing region with other open sibling regions. If A is defined, shift for A times.
5. `Space` or `-`: Without parameters, close the current region and move to the next open region. With parameters, set the maximum depth of splitting (default is 2).
6. `Enter`/`.`: close all open regions. When all regions are closed, press `Enter` will save the layout and exit the editor.
7. `Backspace`: undo the last command.

View File

@ -386,14 +386,14 @@ function start_editor(data)
elseif key == "s" or key == "S" then
if #open_areas > 0 then
key = "s"
local times = num_1 or 1
local top = pop_open_area()
local t = {}
local t = {top}
while #open_areas > 0 and open_areas[#open_areas].depth == top.depth do
t[#t + 1] = pop_open_area()
end
open_areas[#open_areas + 1] = top
for i = #t, 1, -1 do
open_areas[#open_areas + 1] = t[i]
open_areas[#open_areas + 1] = t[(i + times - 1) % #t + 1]
end
num_1 = nil
num_2 = nil