Change some search actions and results text. Force repaint for when resizing and show happens

This commit is contained in:
Lam Wei Lun
2026-09-24 10:41:55 +08:00
parent b46916a8be
commit 54c32a54b4
6 changed files with 95 additions and 47 deletions
+3 -3
View File
@@ -390,7 +390,7 @@ function favDigitFromEvent(e) {
function resultCountText(total, shown, query) {
return (query || "").trim() ?
T("sd_result_count", "Showing %s of %s actions", shown, total) :
T("sd_result_count", "Showing %s actions", shown) :
T("sd_result_count_all", "%s actions", total);
}
@@ -711,7 +711,7 @@ window.HandleStudio = function (payload) {
builtKey = "";
if (qEl) {
qEl.value = "";
qEl.placeholder = T("sd_search_n", "Search %s actions", ACTIONS.length);
qEl.placeholder = T("sd_search", "Search actions");
syncClearButton();
}
render({ resize: true, resetScroll: true });
@@ -1376,7 +1376,7 @@ function exitPhase() {
// It survives a second-phase exit (which never goes through exitPhase from the commands view),
// so without a reset the cached empty-query key would skip the rebuild and leave stale content.
builtKey = "";
qEl.placeholder = T("sd_search_n", "Search %s actions", ACTIONS.length);
qEl.placeholder = T("sd_search", "Search actions");
render({ resize: true, resetScroll: true });
qEl.focus();
}
@@ -436,4 +436,9 @@ assert.equal(ctx.stateFromPayload({}).tooltipExpanded, true, "expansion defaults
assert.equal(ctx.stateFromPayload({ tooltip_expanded: false }).tooltipExpanded, false, "a collapsed payload is honored");
assert.equal(ctx.stateFromPayload({ tooltip_expanded: true }).tooltipExpanded, true, "an expanded payload is honored");
// resultCountText: a search counts the shown matches only ("Showing N actions"); the total is used
// solely for the empty-query count.
assert.equal(ctx.resultCountText(100, 3, "lay"), "Showing 3 actions", "a search reports the shown match count only");
assert.equal(ctx.resultCountText(100, 100, ""), "100 actions", "an empty query reports the total");
console.log("ok");