This commit is contained in:
Gold Holk 2026-09-05 09:43:20 -07:00 committed by GitHub
commit 578caf5f4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 1 deletions

View file

@ -73,6 +73,16 @@ controller.setExCmds({
hint: HintingCmds,
})
// limit the command history size
setTimeout(async () => {
const limit = await config.getAsync('historycmdcountlimit')
if (limit < 0) return
const cmdHistory = state.cmdHistory
if (cmdHistory.length > alert) {
state.cmdHistory = cmdHistory.slice(-Math.floor(limit * 2/3))
}
}, 15 * 1000)
// {{{ tri.contentLocation
let contentLocationCount = 0
function updateContentLocation(windowId = browser.windows.WINDOW_ID_CURRENT) {

View file

@ -196,7 +196,8 @@ export function getCommandlineFns(cmdline_state: {
if (
!command.startsWith(" ") &&
!browser.extension.inIncognitoContext &&
!(func === "winopen" && args[0] === "-private")
!(func === "winopen" && args[0] === "-private") &&
!command.startsWith(" ")
) {
State.getAsync("cmdHistory").then(c => {
cmdline_state.state.cmdHistory = c.concat([command])

View file

@ -1304,6 +1304,11 @@ export class default_config {
*/
searchurlopen: "true" | "false" = "true"
/**
* Reduce the size (line count) of ex command history if the size is larger than the historycmdcountalert when tridactyl started. The size will be reduce to the 2/3 of the limit. Set the limit to -1 to disable history limit.
*/
historycmdcountlimit = 1536
/**
* When displaying bookmarks in history completions, how many page views to pretend they have.
*/