WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 200770
Web Inspector: CodeMirror still inserts a tab even when "Prefer indent using" is set to "Spaces"
https://bugs.webkit.org/show_bug.cgi?id=200770
Summary
Web Inspector: CodeMirror still inserts a tab even when "Prefer indent using"...
Devin Rousso
Reported
2019-08-15 09:25:31 PDT
# STEPS TO REPRODUCE: 1. inspect any page 2. go to any resource that is editable 3. press tab ↹ => \t inserted instead of " " (4)
Attachments
Patch
(1.63 KB, patch)
2019-08-15 09:26 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Patch
(1.88 KB, patch)
2019-08-15 09:59 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Patch
(1.87 KB, patch)
2019-08-15 10:31 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Patch
(1.98 KB, patch)
2019-08-15 11:13 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Devin Rousso
Comment 1
2019-08-15 09:26:45 PDT
Created
attachment 376384
[details]
Patch
Ross Kirsling
Comment 2
2019-08-15 09:50:28 PDT
Is this better than having WI make Tab execute `insertSoftTab` and specify `options.tabSize` appropriately?
Devin Rousso
Comment 3
2019-08-15 09:55:54 PDT
(In reply to Ross Kirsling from
comment #2
)
> Is this better than having WI make Tab execute `insertSoftTab` and specify `options.tabSize` appropriately?
I didn't even know that was a thing! I'll give it a shot =D
Devin Rousso
Comment 4
2019-08-15 09:59:01 PDT
Created
attachment 376387
[details]
Patch
Ross Kirsling
Comment 5
2019-08-15 10:23:35 PDT
Comment on
attachment 376387
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=376387&action=review
It's still a bit sad to me, but I guess it's how we've got to do it:
https://github.com/codemirror/CodeMirror/pull/4317
> Source/WebInspectorUI/UserInterface/Views/CodeMirrorAdditions.js:624 > + CodeMirror.commands.insertTab = function(cm) {
Maybe it'd still be better to overwrite `defaultTab`, so that you don't have to store `original`?
> Source/WebInspectorUI/UserInterface/Views/CodeMirrorAdditions.js:625 > + if (WI.settings.indentWithTabs.value)
I think this can be `cm.options.indentWithTabs`, given all this:
https://github.com/WebKit/webkit/blob/master/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js#L36-L58
Devin Rousso
Comment 6
2019-08-15 10:29:58 PDT
Comment on
attachment 376387
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=376387&action=review
>> Source/WebInspectorUI/UserInterface/Views/CodeMirrorAdditions.js:624 >> + CodeMirror.commands.insertTab = function(cm) { > > Maybe it'd still be better to overwrite `defaultTab`, so that you don't have to store `original`?
I'd rather not, as that would require that I duplicate the `if (cm.somethingSelected()) { cm.indentSelection("add") }` logic, which adds complexity and potential confusion each time we update CodeMirror.
>> Source/WebInspectorUI/UserInterface/Views/CodeMirrorAdditions.js:625 >> + if (WI.settings.indentWithTabs.value) > > I think this can be `cm.options.indentWithTabs`, given all this: >
https://github.com/WebKit/webkit/blob/master/Source/WebInspectorUI/UserInterface/Views/CodeMirrorEditor.js#L36-L58
Good point. I'll switch.
Devin Rousso
Comment 7
2019-08-15 10:31:44 PDT
Created
attachment 376390
[details]
Patch
Ross Kirsling
Comment 8
2019-08-15 10:36:17 PDT
(In reply to Devin Rousso from
comment #6
)
> I'd rather not, as that would require that I duplicate the `if > (cm.somethingSelected()) { cm.indentSelection("add") }` logic, which adds > complexity and potential confusion each time we update CodeMirror.
Even with this solution though, I wonder if a comment would be in order to encourage us to keep an eye on it across CodeMirror updates? (Maybe we could link to the PR as a justification for why we had to go this route.)
Ross Kirsling
Comment 9
2019-08-15 10:36:31 PDT
Comment on
attachment 376390
[details]
Patch r=me otherwise
Devin Rousso
Comment 10
2019-08-15 11:13:48 PDT
Created
attachment 376396
[details]
Patch
WebKit Commit Bot
Comment 11
2019-08-15 12:32:21 PDT
Comment on
attachment 376396
[details]
Patch Clearing flags on attachment: 376396 Committed
r248739
: <
https://trac.webkit.org/changeset/248739
>
WebKit Commit Bot
Comment 12
2019-08-15 12:32:22 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 13
2019-08-15 12:33:17 PDT
<
rdar://problem/54358187
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug