We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents d42d7de + 375d9d7 commit 66ec890Copy full SHA for 66ec890
lib/awful/menu.lua
@@ -108,7 +108,7 @@ menu.menu_keys = { up = { "Up", "k" },
108
down = { "Down", "j" },
109
back = { "Left", "h" },
110
exec = { "Return" },
111
- enter = { "Right", "l" },
+ enter = { "Right", "l", "KP_Enter" },
112
close = { "Escape" } }
113
114
lib/gears/string.lua
@@ -87,6 +87,7 @@ function gstring.query_to_pattern(q)
87
return s
88
end
89
90
+
91
--- Split separates a string containing a delimiter into the list of
92
-- substrings between that delimiter.
93
-- @tparam string str String to be splitted
@@ -110,6 +111,33 @@ function gstring.split(str, delimiter)
return result
115
+--- Pattern split separates a string by a pattern to the table of substrings.
116
+-- @tparam string str String to be splitted
117
+-- @tparam string[opt="\n"] pattern Pattern the target string will
118
+-- be splitted by.
119
+-- @treturn table A list of substrings.
120
+-- @staticfct gears.string.split
121
+function gstring.psplit(str, pattern)
122
+ pattern = pattern or "\n"
123
+ local result = {}
124
+ if #pattern == 0 then
125
+ for index = 1, #str do
126
+ result[#result+1] = str:sub(index, index)
127
+ end
128
+ return result
129
130
+ local pos = 1
131
+ for match in str:gmatch(pattern) do
132
+ local start_pos, end_pos = str:find(match, pos, true)
133
+ result[#result+1] = str:sub(pos, start_pos-1)
134
+ pos = end_pos+1
135
136
+ result[#result+1] = str:sub(pos, #str)
137
138
+end
139
140
141
--- Check if a string starts with another string.
142
-- @DOC_text_gears_string_startswith_EXAMPLE@
143
-- @tparam string str String to search
lib/naughty/dbus.lua
@@ -69,6 +69,9 @@ local function sendNotificationClosed(notificationId, reason)
69
if reason <= 0 then
70
reason = cst.notification_closed_reason.undefined
71
72
+ if reason == cst.notification_closed_reason.dismissed_by_user then
73
+ sendActionInvoked(notificationId, "default")
74
75
if bus_connection then
76
bus_connection:emit_signal(nil, "/org/freedesktop/Notifications",
77
"org.freedesktop.Notifications", "NotificationClosed",
objects/drawable.c
@@ -141,10 +141,10 @@ drawable_set_geometry(lua_State *L, int didx, area_t geom)
area_t old = d->geometry;
d->geometry = geom;
144
- bool size_changed = (old.width != geom.width) || (old.height != geom.height);
145
- if (size_changed)
+ bool area_changed = !AREA_EQUAL(old, geom);
+ if (area_changed)
146
drawable_unset_surface(d);
147
- if (size_changed && geom.width > 0 && geom.height > 0)
+ if (area_changed && geom.width > 0 && geom.height > 0)
148
{
149
d->pixmap = xcb_generate_id(globalconf.connection);
150
xcb_create_pixmap(globalconf.connection, globalconf.default_depth, d->pixmap,
@@ -155,7 +155,7 @@ drawable_set_geometry(lua_State *L, int didx, area_t geom)
155
luaA_object_emit_signal(L, didx, "property::surface", 0);
156
}
157
158
- if (!AREA_EQUAL(old, geom))
159
luaA_object_emit_signal(L, didx, "property::geometry", 0);
160
if (old.x != geom.x)
161
luaA_object_emit_signal(L, didx, "property::x", 0);
spec/gears/string_spec.lua
@@ -57,6 +57,20 @@ describe("gears.string", function()
57
assert.is_same(gstring.split("foo.", "."), {"foo", ""})
58
assert.is_same(gstring.split("foo.bar", "."), {"foo", "bar"})
59
end)
60
61
+ describe("psplit", function()
62
+ assert.is_same(gstring.psplit("", ""), {})
63
+ assert.is_same(gstring.psplit(".", ""), {"."})
64
+ assert.is_same(gstring.psplit("foo", ""), {"f", "o", "o"})
65
+ assert.is_same(gstring.psplit("foo.", ""), {"f", "o", "o", "."})
66
+ assert.is_same(gstring.psplit("foo.bar", "%."), {"foo", "bar"})
67
68
+ assert.is_same(gstring.psplit("", "."), {""})
+ assert.is_same(gstring.psplit("a", "."), {"", ""})
+ assert.is_same(gstring.psplit("foo", "."), {"", "", "", ""})
+ assert.is_same(gstring.psplit("foo.", "%W"), {"foo", ""})
+ assert.is_same(gstring.psplit(".foo.2.5.bar.73", "%.%d"), {".foo", "", ".bar", "3"})
+ end)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
0 commit comments