Open Bug 961993 Opened 10 years ago Updated 2 years ago

Hitting tab more than once indents by tabsize-1 columns

Categories

(DevTools :: Source Editor, defect)

x86
macOS
defect

Tracking

(Not tracked)

People

(Reporter: past, Unassigned)

Details

With the default devtools.editor.tabsize setting of 4, open scratchpad and then:
1) Type: 01234567890123456789
2) Hit ENTER and then type: i
3) Move the cursor to the beginning of the second line (before "i") and hit TAB
4) Observe the cursor move from 0 to 4
5) Hit TAB again
6) Observe the cursor move from 4 to 7

If you hit TAB one more time you will see the cursor move to 0. It looks like there is an off-by-one error somewhere.
With tab size as 2, I get 2 spaces on the first tab and then single space on subsequent tab presses
I believe the cause is this line in editor.js

if (cm.getCursor().ch !== 0) num -= 1;

which reduces the indent amount by one if the cursor is not at the first column
Product: Firefox → DevTools
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.