Open a document (JavaScript) that only contains a Tab followed by any character. Status bar settings should use `%C` to display column position (if your setting is `%c`, subtract 1 to all my examples).
→a
(where the → character represents the Tab character)
- When you press Ctrl+Home, column is 1, correct 👍 - When you press Ctrl+End, column should be 3, but it is 6 👎 - Indeed, when you now press left arrow, column should be 2, but it is 5 👎
The problem is that the Tab is counted as 4 characters instead of 1.
Therefore, eslint error messages (correct) lead to wrong column.
In the file with `Tab a` go to the next line and type 5 `a`s , the last `a` lines up with the `a` in the line above, so clearly the `a` in the line above is in column 5.
You appear to have confused character count and column count, a column is a vertical strip of screen, a character is an entity in teh file, the file may only have two characters `Tab` and `a` but `Tab` occupies 4 columns and `a` one, total 5.
Note eslint doesn't count columns, it counts code points AFAICT from its demo, paste ö (note copy and paste from here, its two code points not just one) in the `foo` and see what the "column" of the bar error says, although the `o Umlaut` shows as one its actually `o` and a `Umlaut` combining character, ie two code points and thats what eslint counts.
Indeed for the **character count** used as we can see with tabs and combining characters. And I do think it's better to master what your code contains, by showing character count, rather than having the virtual column number we have.
You're right that eslint should call this number, **Char** instead of **Col**.
![BabelPad](https://user-images.githubusercontent.com/1401086/105163747-990a6180-5b14-11...)
So it would be nice that we could have a new or modified placeholder in [statusbar template](https://www.geany.org/manual/current/index.html#statusbar-templates), counting **char**. I would use this instead of virtual column (IMO it should even be the new default).
Before Geany, I did not see a tool that displays a virtual column position instead of character position. But I don't know many (I have used EmEditor and BabelPad, mostly).
I tried some other tools right now but here is all I have available handy:
- Linux nano: virtual column position (like Geany) - Windows [notepad2e](https://github.com/ProgerXP/Notepad2e): true character position (like eslint, EmEditor, BabelPad)
There are other famous editors but I don't have them handy.
---
Off topic, for what it's worth:
I guess this issue is what makes the block selection (Crtl+click) slightly _strange_ on tab indented files. Selecting tabs, should not select groups of 4 characters above or below. But it is usually not needed to select both tabs and text in same block, so nvm)
I use tabs to indent, I think as such I am more hindered by this ticket.
I would suggest you create a new issue requesting the status bar count, _if_ such an issue doesn't already exist, as I said elsewhere, it seems reasonable if it can be done sufficiently efficiently. But nobody will find the suggestion buried in here.
Yes tab indents are an idea from the 1970s and belong back there due to all their problems, please let me persuade you to use spaces for indent, Geany does them just fine and modern systems are not that short of storage :) (obviously for new code, sadly old code is usually stuck in the past)
Sorry, I was editing my big post above when you replied.
No need to elaborate on the tabs vs spaces here. IMO it's using space as tabulation that is ugly workaround bringing too many specific work-arounds (like this virtual column position: 1 character but 4 characters).
This ticket is already (thanks to your additional example) about displaying true character count position instead of (or additionally to, like vim does) virtual column.
We should just rename it to not specialise it about tabs.
---
I did find 2 related tickets, but they are about the selected character count, not the position of the caret:
- Number of selected characters #745 - Problem select char counting #1599 (could be a duplicate of previous ticket)
Therefore, eslint error messages (correct) lead to wrong column.
This will be true with most tools, even e.g. GCC. Fortunately, if you run those tool from inside Geany (as a build command), support for extracting the offset on the line uses character? code point? anyway, it "just works" for most people currently. So if you called eslint that way, it would probably work.
IMO the issue here is "invalid" as we do display the visual column (not character count) which is what was intended, yet indeed somebody could add a new placeholder for the byte/code point/glyph to fit specific needs. Note the complexity/irrelevance of some of those depending on various factors highlighted e.g. in #745 (encodings, glyph vs. code point, etc.).
I do run eslint from inside Geany (as a build command, great stuff!) but it does not change that eslint tells me character based position (which makes more sense to me, as you already know).
So I don't know what character is provoking the error, as immediately as if Geany would show me character based position too.
Closed #2733.
github-comments@lists.geany.org