right-margin indicator column 0- or 1-indexed?

Discussion about CodeLite development process and patches
petah
CodeLite Expert
Posts: 231
Joined: Sat Nov 24, 2012 8:04 pm
Genuine User: Yes
IDE Question: c++
Location: Los Angeles
Contact:

right-margin indicator column 0- or 1-indexed?

Post 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
main: Debian Jessie x64 + custom wxTrunk
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: right-margin indicator column 0- or 1-indexed?

Post 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
Make sure you have read the HOW TO POST thread
petah
CodeLite Expert
Posts: 231
Joined: Sat Nov 24, 2012 8:04 pm
Genuine User: Yes
IDE Question: c++
Location: Los Angeles
Contact:

Re: right-margin indicator column 0- or 1-indexed?

Post 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
main: Debian Jessie x64 + custom wxTrunk
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: right-margin indicator column 0- or 1-indexed?

Post 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
Make sure you have read the HOW TO POST thread
petah
CodeLite Expert
Posts: 231
Joined: Sat Nov 24, 2012 8:04 pm
Genuine User: Yes
IDE Question: c++
Location: Los Angeles
Contact:

Re: right-margin indicator column 0- or 1-indexed?

Post 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
main: Debian Jessie x64 + custom wxTrunk
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: right-margin indicator column 0- or 1-indexed?

Post by eranif »

Also: clang API uses COL 1 + vim..

Eran
Make sure you have read the HOW TO POST thread
petah
CodeLite Expert
Posts: 231
Joined: Sat Nov 24, 2012 8:04 pm
Genuine User: Yes
IDE Question: c++
Location: Los Angeles
Contact:

Re: right-margin indicator column 0- or 1-indexed?

Post 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
You do not have the required permissions to view the files attached to this post.
main: Debian Jessie x64 + custom wxTrunk
petah
CodeLite Expert
Posts: 231
Joined: Sat Nov 24, 2012 8:04 pm
Genuine User: Yes
IDE Question: c++
Location: Los Angeles
Contact:

Re: right-margin indicator column 0- or 1-indexed?

Post 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
You do not have the required permissions to view the files attached to this post.
main: Debian Jessie x64 + custom wxTrunk
Post Reply