By "smart braces" I mean: - When I type "(", a closing brace should be added immediately and the cursor should be located inside "()" pair. - When then I hit "Backspace", both braces should be deleted - If, instead, I type ")" - cursor should go over closing brace without adding a new one.
Created attachment 187125 [details] Patch
Created attachment 187133 [details] Patch
Created attachment 187809 [details] Patch
Comment on attachment 187809 [details] Patch test expectations not updated
Created attachment 187811 [details] Patch
Created attachment 187819 [details] Patch
Comment on attachment 187819 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=187819&action=review > Source/WebCore/inspector/front-end/DefaultTextEditor.js:1398 > + this._textInputInterceptors["("] = this._handleBracePairInsertion.bind(this, "()"); registerInterceptor("(", "()", this._handleBracePairInsertion); would look more user-friendly > Source/WebCore/inspector/front-end/DefaultTextEditor.js:2829 > + var interceptor = this._textInputInterceptors[event.data]; textInput will trigger for pasting text as well and you don't want interceptors to work there. Instad of text input interceptors, you want keyDown handlers.
Created attachment 188329 [details] Patch
Comment on attachment 187819 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=187819&action=review >> Source/WebCore/inspector/front-end/DefaultTextEditor.js:1398 >> + this._textInputInterceptors["("] = this._handleBracePairInsertion.bind(this, "()"); > > registerInterceptor("(", "()", this._handleBracePairInsertion); would look more user-friendly not sure I got your idea.. Do you mean we should create a public "registerInterceptor" method? >> Source/WebCore/inspector/front-end/DefaultTextEditor.js:2829 >> + var interceptor = this._textInputInterceptors[event.data]; > > textInput will trigger for pasting text as well and you don't want interceptors to work there. Instad of text input interceptors, you want keyDown handlers. fixed to handling in keyPress
Comment on attachment 188329 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=188329&action=review > Source/WebCore/inspector/front-end/DefaultTextEditor.js:3549 > + } else return false > Source/WebCore/inspector/front-end/DefaultTextEditor.js:3595 > + } else return false;
Comment on attachment 188329 [details] Patch Clearing flags on attachment: 188329 Committed r142983: <http://trac.webkit.org/changeset/142983>
All reviewed patches have been landed. Closing bug.