minor change

This commit is contained in:
Xinhao Yuan 2019-08-01 09:54:18 -04:00
parent d30d25dc8d
commit 16fdf8cdd8
2 changed files with 6 additions and 15 deletions

View File

@ -144,7 +144,7 @@ To change that, please refer to `editor.lua`. (XXX more documents)
Calling `machi.switcher.start()` will create a switcher supporting the following keys:
- Arrow keys: move focus into other regions by the direction.
- `Shift` + arrow keys: move the focused window to other regions by the direction. In draft mode, move the upper-left region by direction.
- `Shift` + arrow keys: move the focused window to other regions by the direction. In draft mode, move the window while preserving its size.
- `Control` + arrow keys: move the bottom-right region of the focused window by direction. Only work in draft mode.
- `Tab`: switch beteen windows covering the current regions.

View File

@ -98,8 +98,8 @@ local function start(c)
local msg, ext
for i, a in ipairs(regions) do
cr:rectangle(a.x - start_x, a.y - start_y, a.width, a.height)
cr:clip()
-- cr:rectangle(a.x - start_x, a.y - start_y, a.width, a.height)
-- cr:clip()
if a.x <= traverse_x and traverse_x < a.x + a.width and
a.y <= traverse_y and traverse_y < a.y + a.height then
@ -271,20 +271,11 @@ local function start(c)
tablist = nil
if shift then
-- move the window
if draft_mode then
-- move the left-up region
local lu = choice
local rd = c.machi_rd
if regions[rd].x + regions[rd].width <= regions[lu].x or
regions[rd].y + regions[rd].height <= regions[lu].y
then
rd = lu
end
machi.layout.set_geometry(c, regions[lu], regions[rd], 0, c.border_width)
c.machi_lu = lu
c.machi_rd = rd
c.x = regions[choice].x
c.y = regions[choice].y
else
-- move the window
machi.layout.set_geometry(c, regions[choice], regions[choice], 0, c.border_width)
c.machi_region = choice
end