diff --git a/README.mdown b/README.mdown index 334f7e7..9f9f77e 100644 --- a/README.mdown +++ b/README.mdown @@ -35,6 +35,7 @@ Changelog - Added a status bar with char/line display - Added a toggle button to expand/collapse all krumo sub-trees at once - Cross-browser compatibility enhancements + - Removing a tab (i.e. 4 spaces) on backspace now - 1.0.0 - Initial Public Release diff --git a/php-console.js b/php-console.js index 02bc706..832d911 100644 --- a/php-console.js +++ b/php-console.js @@ -62,6 +62,18 @@ $(function() { e.preventDefault(); } break; + case 8: + // deindent automatically on backspace + caret = $(this).getCaret(); + part = $(this).val().substr(0, caret); + if (part.match(/\n( {4,})$/)) { + $(this).val(function(idx, val) { + return val.substring(0, caret - 4) + val.substring(caret); + }); + $(this).setCaret(caret - 4); + e.preventDefault(); + } + break; } updateStatusBar();