English is hard again. inhabitable -> habitable and use the right meaning.

This commit is contained in:
Xinhao Yuan 2021-02-28 11:23:59 -05:00
parent 07adcbdad0
commit 4099e6fde6
5 changed files with 21 additions and 20 deletions

View File

@ -89,7 +89,7 @@ For `new_placement_cb` the arguments are:
- `tag_data`: a mapping from area ids to their fake tag data. This is for nested layouts. - `tag_data`: a mapping from area ids to their fake tag data. This is for nested layouts.
- `areas`: the current array of areas produced by `instance.cmd`. Each area is a table with the following fields available: - `areas`: the current array of areas produced by `instance.cmd`. Each area is a table with the following fields available:
- `id`: self index of the array. - `id`: self index of the array.
- `inhabitable`: if true, the area is not for placing windows. It could be a parent area, or area disabled by command `/`. - `habitable`: if true, the area is for placing windows. It could be false for a parent area, or an area disabled by command `/`.
- `x`, `y`, `width`, `height`: area geometry. - `x`, `y`, `width`, `height`: area geometry.
- `layout`: the string used to index the nested layout, if any. - `layout`: the string used to index the nested layout, if any.
- `geometry`: the output table the client geometry. Note that the geometry _includes_ the borders. - `geometry`: the output table the client geometry. Note that the geometry _includes_ the borders.

View File

@ -262,7 +262,7 @@ function module.create(data)
local msg, ext local msg, ext
for i, a in ipairs(closed_areas) do for i, a in ipairs(closed_areas) do
if not a.inhabitable then if a.habitable then
local sa = shrink_area_with_gap(a, gap) local sa = shrink_area_with_gap(a, gap)
local to_highlight = false local to_highlight = false
if pending_op ~= nil then if pending_op ~= nil then
@ -286,7 +286,7 @@ function module.create(data)
end end
for i, a in ipairs(open_areas) do for i, a in ipairs(open_areas) do
if not a.inhabitable then if a.habitable then
local sa = shrink_area_with_gap(a, gap) local sa = shrink_area_with_gap(a, gap)
local to_highlight = false local to_highlight = false
if not pending_op then if not pending_op then

View File

@ -4,7 +4,7 @@
-- parent_cid -- parent_cid
-- parent_x_shares -- parent_x_shares
-- parent_y_shares -- parent_y_shares
-- inhabitable -- habitable
-- hole (unique) -- hole (unique)
-- } -- }
-- --
@ -243,6 +243,7 @@ local function areas_from_command(command, workarea, minimum)
local i = #closed_areas + 1 local i = #closed_areas + 1
closed_areas[i] = a closed_areas[i] = a
a.id = i a.id = i
a.habitable = true
return a, i return a, i
end end
@ -284,7 +285,7 @@ local function areas_from_command(command, workarea, minimum)
end end
local a, area_index = close_area() local a, area_index = close_area()
a.inhabitable = true a.habitable = false
a.split = { a.split = {
method = method, method = method,
x_shares = method == "h" and shares or {{1}}, x_shares = method == "h" and shares or {{1}},
@ -396,7 +397,7 @@ local function areas_from_command(command, workarea, minimum)
end end
local a, area_index = close_area() local a, area_index = close_area()
a.inhabitable = true a.habitable = false
a.split = { a.split = {
method = method, method = method,
x_shares = x_shares, x_shares = x_shares,
@ -561,7 +562,7 @@ local function areas_from_command(command, workarea, minimum)
elseif method == "/" then elseif method == "/" then
close_area().inhabitable = true close_area().habitable = false
elseif method == ";" then elseif method == ";" then
@ -761,7 +762,7 @@ local function areas_from_command(command, workarea, minimum)
if closed_areas[i].x + closed_areas[i].width > root.x + orig_width or if closed_areas[i].x + closed_areas[i].width > root.x + orig_width or
closed_areas[i].y + closed_areas[i].height > root.y + orig_height closed_areas[i].y + closed_areas[i].height > root.y + orig_height
then then
closed_areas[i].inhabitable = true closed_areas[i].habitable = false
end end
end end
@ -769,7 +770,7 @@ local function areas_from_command(command, workarea, minimum)
if open_areas[i].x + open_areas[i].width > root.x + orig_width or if open_areas[i].x + open_areas[i].width > root.x + orig_width or
open_areas[i].y + open_areas[i].height > root.y + orig_height open_areas[i].y + open_areas[i].height > root.y + orig_height
then then
open_areas[i].inhabitable = true open_areas[i].habitable = false
end end
end end

View File

@ -49,7 +49,7 @@ local function find_area(c, areas)
local choice_value = nil local choice_value = nil
local c_area = c.width * c.height local c_area = c.width * c.height
for i, a in ipairs(areas) do for i, a in ipairs(areas) do
if not a.inhabitable then if a.habitable then
local x_cap = max(0, min(c.x + c.width, a.x + a.width) - max(c.x, a.x)) local x_cap = max(0, min(c.x + c.width, a.x + a.width) - max(c.x, a.x))
local y_cap = max(0, min(c.y + c.height, a.y + a.height) - max(c.y, a.y)) local y_cap = max(0, min(c.y + c.height, a.y + a.height) - max(c.y, a.y))
local cap = x_cap * y_cap local cap = x_cap * y_cap
@ -80,7 +80,7 @@ end
local function find_lu(c, areas, rd) local function find_lu(c, areas, rd)
local lu = nil local lu = nil
for i, a in ipairs(areas) do for i, a in ipairs(areas) do
if not a.inhabitable then if a.habitable then
if rd == nil or (a.x < areas[rd].x + areas[rd].width and a.y < areas[rd].y + areas[rd].height) then if rd == nil or (a.x < areas[rd].x + areas[rd].width and a.y < areas[rd].y + areas[rd].height) then
if lu == nil or distance(c.x, c.y, a.x, a.y) < distance(c.x, c.y, areas[lu].x, areas[lu].y) then if lu == nil or distance(c.x, c.y, a.x, a.y) < distance(c.x, c.y, areas[lu].x, areas[lu].y) then
lu = i lu = i
@ -97,7 +97,7 @@ local function find_rd(c, border_width, areas, lu)
y = c.y + c.height + (border_width or 0) * 2 y = c.y + c.height + (border_width or 0) * 2
local rd = nil local rd = nil
for i, a in ipairs(areas) do for i, a in ipairs(areas) do
if not a.inhabitable then if a.habitable then
if lu == nil or (a.x + a.width > areas[lu].x and a.y + a.height > areas[lu].y) then if lu == nil or (a.x + a.width > areas[lu].x and a.y + a.height > areas[lu].y) then
if rd == nil or distance(x, y, a.x + a.width, a.y + a.height) < distance(x, y, areas[rd].x + areas[rd].width, areas[rd].y + areas[rd].height) then if rd == nil or distance(x, y, a.x + a.width, a.y + a.height) < distance(x, y, areas[rd].x + areas[rd].width, areas[rd].y + areas[rd].height) then
rd = i rd = i
@ -267,7 +267,7 @@ function module.create(args_or_name, editor, default_cmd)
if in_draft ~= false then if in_draft ~= false then
if cd[c].lu ~= nil and cd[c].rd ~= nil and if cd[c].lu ~= nil and cd[c].rd ~= nil and
cd[c].lu <= #areas and cd[c].rd <= #areas and cd[c].lu <= #areas and cd[c].rd <= #areas and
not areas[cd[c].lu].inhabitable and not areas[cd[c].rd].inhabitable areas[cd[c].lu].habitable and areas[cd[c].rd].habitable
then then
if areas[cd[c].lu].x == geo.x and if areas[cd[c].lu].x == geo.x and
areas[cd[c].lu].y == geo.y and areas[cd[c].lu].y == geo.y and
@ -305,7 +305,7 @@ function module.create(args_or_name, editor, default_cmd)
else else
if cd[c].area ~= nil and if cd[c].area ~= nil and
cd[c].area <= #areas and cd[c].area <= #areas and
not areas[cd[c].area].inhabitable and areas[cd[c].area].habitable and
areas[cd[c].area].layout == nil and areas[cd[c].area].layout == nil and
areas[cd[c].area].x == geo.x and areas[cd[c].area].x == geo.x and
areas[cd[c].area].y == geo.y and areas[cd[c].area].y == geo.y and
@ -435,7 +435,7 @@ function module.create(args_or_name, editor, default_cmd)
local choice_value = nil local choice_value = nil
for i, a in ipairs(areas) do for i, a in ipairs(areas) do
if not a.inhabitable then if a.habitable then
local ac_x = a.x + a.width / 2 local ac_x = a.x + a.width / 2
local ac_y = a.y + a.height / 2 local ac_y = a.y + a.height / 2
local dis = (ac_x - center_x) * (ac_x - center_x) + (ac_y - center_y) * (ac_y - center_y) local dis = (ac_x - center_x) * (ac_x - center_x) + (ac_y - center_y) * (ac_y - center_y)
@ -505,7 +505,7 @@ function module.placement.fair(c, instance, areas, geometry)
local choice = nil local choice = nil
for i = 1, #areas do for i = 1, #areas do
local a = areas[i] local a = areas[i]
if not a.inhabitable then if a.habitable then
local emptyness = a.width * a.height / ((area_client_count[i] or 0) + 1) local emptyness = a.width * a.height / ((area_client_count[i] or 0) + 1)
if emptyness_max == nil or emptyness > emptyness_max then if emptyness_max == nil or emptyness > emptyness_max then
emptyness_max = emptyness emptyness_max = emptyness

View File

@ -121,7 +121,7 @@ function module.start(c, exit_keys)
if selected_area_ == nil then if selected_area_ == nil then
local min_dis = nil local min_dis = nil
for i, a in ipairs(areas) do for i, a in ipairs(areas) do
if not a.inhabitable then if a.habitable then
local dis = local dis =
math.abs(a.x + traverse_radius - traverse_x) + math.abs(a.x + a.width - traverse_radius - traverse_x) - a.width + math.abs(a.x + traverse_radius - traverse_x) + math.abs(a.x + a.width - traverse_radius - traverse_x) - a.width +
math.abs(a.y + traverse_radius - traverse_y) + math.abs(a.y + a.height - traverse_radius - traverse_y) - a.height + math.abs(a.y + traverse_radius - traverse_y) + math.abs(a.y + a.height - traverse_radius - traverse_y) - a.height +
@ -191,7 +191,7 @@ function module.start(c, exit_keys)
local msg, ext local msg, ext
local active_area = selected_area() local active_area = selected_area()
for i, a in ipairs(areas) do for i, a in ipairs(areas) do
if not a.inhabitable or i == active_area then if a.habitable or i == active_area then
cr:rectangle(a.x - start_x, a.y - start_y, a.width, a.height) cr:rectangle(a.x - start_x, a.y - start_y, a.width, a.height)
cr:clip() cr:clip()
cr:set_source(fill_color) cr:set_source(fill_color)
@ -354,7 +354,7 @@ function module.start(c, exit_keys)
current_area = selected_area() current_area = selected_area()
for i, a in ipairs(areas) do for i, a in ipairs(areas) do
if a.inhabitable then goto continue end if not a.habitable then goto continue end
local v local v
if key == "Up" then if key == "Up" then
@ -530,7 +530,7 @@ function module.start(c, exit_keys)
current_area = parent_stack[#parent_stack] current_area = parent_stack[#parent_stack]
if c and ctrl then if c and ctrl then
if not areas[current_area].inhabitable and cd[c].draft ~= true then if areas[current_area].habitable and cd[c].draft ~= true then
cd[c].lu, cd[c].rd, cd[c].area = nil, nil, current_area cd[c].lu, cd[c].rd, cd[c].area = nil, nil, current_area
end end
machi.layout.set_geometry(c, areas[current_area], areas[current_area], 0, c.border_width) machi.layout.set_geometry(c, areas[current_area], areas[current_area], 0, c.border_width)