Commit 4636cca1 authored by thatcher's avatar thatcher

Reviewed by Tim H.

        Added a bash-style command history.

        * Drosera/console.js:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@16781 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d129eadb
2006-10-04 David Smith <catfish.man@gmail.com>
Reviewed by Tim H.
Added a bash-style command history.
* Drosera/console.js:
2006-10-03 Anders Carlsson <acarlsson@apple.com>
Reviewed by Adam and Brady.
......
/*
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2006 David Smith (catfish.man@gmail.com)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -28,6 +29,8 @@
var inputElement = null;
var mainWindow = window.opener;
var historyIndex = -1;
var storedInput = null;
function loaded()
{
......@@ -46,6 +49,29 @@ function inputKeyDown(event)
} else
alert("The debugger needs to be paused.\tIn order to evaluate your script input you need to pause the debugger in the context of another script.");
event.preventDefault();
} else if (event.keyCode == 38 && !event.altKey) {
var history = document.getElementById("history");
if(historyIndex == -1)
storedInput = inputElement.innerText;
var historyArray = history.childNodes;
var historySize = historyArray.length - 1;
if(historyIndex < historySize) {
historyIndex++;
inputElement.innerText = historyArray[historySize - historyIndex].childNodes[0].innerText;
}
event.preventDefault();
} else if (event.keyCode == 40 && !event.altKey) {
if(historyIndex >= 0) {
var history = document.getElementById("history");
historyIndex--;
if (historyIndex == -1)
inputElement.innerText = storedInput;
else {
var historyArray = history.childNodes;
inputElement.innerText = historyArray[(historyArray.length - 1) - historyIndex].childNodes[0].innerText;
}
}
event.preventDefault();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment