Page 1 of 1
right-margin indicator column 0- or 1-indexed?
Posted: Sun Mar 10, 2013 1:37 am
by petah
the source code display right-margin indicator is off by 1 unit compared to VisualStudio and geany; their column index starts at index 1, CL's at zero. This affects both the vertical column indicator and status bar.
Is the 1-based source column index "correct", i.e. CL's zero-based index is a bug worth a fix, or is the 0-vs-1 index considered subjective? (rows definitely start at 1).
If it's a bug, is a fix preferable in ./LiteEditor/cl_editor.cpp or at a lower-level in ./patches/stc.cpp ?
cheers,
-- p
Re: right-margin indicator column 0- or 1-indexed?
Posted: Sun Mar 10, 2013 10:56 am
by eranif
petah wrote:If it's a bug, is a fix preferable in ./LiteEditor/cl_editor.cpp or at a lower-level in ./patches/stc.cpp ?
I don't think that 0 based col is a bug. However, it should also reflect to the right margin indicator - this should be fixed
A fix should go into cl_editor.cpp
the ./patches/* files are no longer used under linux (only windows/mac atm) and it will be removed in the next release of wxWidgets
Eran
Re: right-margin indicator column 0- or 1-indexed?
Posted: Sun Mar 10, 2013 6:23 pm
by petah
ok, just to be clear:
- the status bar text "ln, col" should remain unchanged
- the vertical line right-margin indicator should be nudged one unit to the right
If so I should have a fix shortly.
-- p
Re: right-margin indicator column 0- or 1-indexed?
Posted: Sun Mar 10, 2013 6:57 pm
by eranif
petah wrote:the status bar text "ln, col" should remain unchanged
I tested gedit and it seems that COL should start from 1
Eran
Re: right-margin indicator column 0- or 1-indexed?
Posted: Sun Mar 10, 2013 7:40 pm
by petah
it's a grey area I think; Geany's col starts at 0 while nano's at 1 (don't have Windows up to test VS).
gcc reports an error at col 1 when putting a syntax error ("%") so I guess 1 does make more sense.
-- p
Re: right-margin indicator column 0- or 1-indexed?
Posted: Sun Mar 10, 2013 7:51 pm
by eranif
Also: clang API uses COL 1 + vim..
Eran
Re: right-margin indicator column 0- or 1-indexed?
Posted: Mon Mar 11, 2013 2:47 am
by petah
been using this patch without problems for a few weeks but can't vouch for it 100% cause I'm not entirely clear which sources are run-time generated and the setval(obj->getval()+1) pattern looks disturbingly recursion-prone if it's not a strict MVC.
It never happened to me but pls double-check the patch before application.
cheers,
-- p
Re: right-margin indicator column 0- or 1-indexed?
Posted: Sat Mar 23, 2013 11:55 pm
by petah
if the column numbering is still up for debate, here's a patch fixing only the right edge column position.
Btw many editors (like Geany) will exhibit the same bug if they're based on Scintilla/wxStyledTextCtrl.
cheers,
-- p