Page MenuHomePhabricator

Columns start at 0, not 1
Closed, DeclinedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:
The bottom-right part says "1:0". When you use "Go to line" and enter "1:1", the caret moves to after the first character (what any other editor considers 1:2).

What should have happened instead?:
The bottom-right part says "1:1". When you use "Go to line" and enter "1:1", the caret moves to before the first character.

Event Timeline

Bhsd subscribed.

This is the expected behavior which is consistent with Extension:CodeEditor.

That Ace/CodeEditor did something poorly is a terrible excuse to continue doing it that defeats the whole point of replacing it. Name an editor besides Ace that considers the initial caret position to be line 1 but column 0.

CodeMirror internally treats the line and column like this. You are requesting something fundamentally incompatible with the CodeMirror library.

OK, I'll defer to @MusikAnimal. It is my opinion that it defies ASTONISH to go against most other editors, including Notepad, TextEdit, Vim, VSCode, Sublime, Notepad++, and gedit.

I generally defer to Bhsd when it comes to upstream CodeMirror, hehe! We might could simply add 1 to the display of the column number, but go-to line and whatever else presumably would then by off by 1.

Questions that come to mind are:

  • Does the off-by-1 effect the reporting of linting errors from Extension:Linter, TemplateStyles, and Peast?
  • Can this be fixed upstream?
  • Should it be fixed upstream?
  • Does it really matter much anyway?

Well there ya go! I trust that Marijn had very good reason for designing it this way.

Re-declining as it doesn't seem feasible to implement a workaround and it is in the best interest for us to stay inline with upstream CodeMirror.