Removing a tab (i.e. 4 spaces) on backspace now

This commit is contained in:
Jordi Boggiano
2010-09-09 16:27:58 +02:00
parent d049139bd0
commit 399ee95027
2 changed files with 13 additions and 0 deletions
+1
View File
@@ -35,6 +35,7 @@ Changelog
- Added a status bar with char/line display - Added a status bar with char/line display
- Added a toggle button to expand/collapse all krumo sub-trees at once - Added a toggle button to expand/collapse all krumo sub-trees at once
- Cross-browser compatibility enhancements - Cross-browser compatibility enhancements
- Removing a tab (i.e. 4 spaces) on backspace now
- 1.0.0 - 1.0.0
- Initial Public Release - Initial Public Release
+12
View File
@@ -62,6 +62,18 @@ $(function() {
e.preventDefault(); e.preventDefault();
} }
break; 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(); updateStatusBar();