Add commands for column marks

qwerky
Posts: 172
Joined: 21.10.2013 00:58

Add commands for column marks

Post by qwerky »

Alexey wrote:Posted this "center line" wish-- https://github.com/kvichans/cuda_ext/issues/66

Column markers: option margin_string ?
Yes, I guess column_string?
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

Option is named "margin_string"- see default.json.
qwerky
Posts: 172
Joined: 21.10.2013 00:58

Post by qwerky »

Alexey wrote:Option is named "margin_string"- see default.json.
Ah, yes, that option when set in user.json does create the column marks.

BUT... how does one set/modify those column marks without editing user.json? More important, how does one navigate between marks.

In early SynWrite there was a built-in function (in later SynWrite it became a plugin) with commands to set the column mark string, and to move cursor left/right to previous/next column mark. Can't seem to find those functions in CudaText--should be simple to add, though?
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

Navigate on marks: commands needed, agree
I will ask Kvichans later after his vacation...
W/out editing json: will ask for a command...
qwerky
Posts: 172
Joined: 21.10.2013 00:58

Post by qwerky »

Alexey wrote:Navigate on marks: commands needed, agree
I will ask Kvichans later after his vacation...
W/out editing json: will ask for a command...
Great, thanks.
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

Plugin in Github:
https://github.com/CudaText-addons/cuda_column_marks
pls try. (use "AddonManager/ Install from Github")
qwerky
Posts: 172
Joined: 21.10.2013 00:58

Post by qwerky »

Alexey wrote:Plugin in Github:
https://github.com/CudaText-addons/cuda_column_marks
pls try. (use "AddonManager/ Install from Github")
Hi Alexey, the plugin does work, with the following notes:
1. When jumping left from the leftmost mark, jumps to column one, and will jump no further (gives message); when jumping right, includes right margin (if set), and will jump no further than right margin or rightmost mark, whichever is further to the right (gives message). That's all correct; it needs no change.

2. When set column marks, it does not update user.json; therefore, if the user changes some other option in user.json and then saves, the column marks are gone. Do you think the plugin should update user.json?

3. This is something that is always confusing. Not having to do specifically with this plugin, but the plugin brings it to mind again:
Let's say your caret shape is a vertical line (perhaps 20%), your right margin is 80, you have the cursor-column-marker (vertical line) turned on, and you have the ruler turned on.

Look at the ruler right margin position: the right margin line is directly on 80--and that is as it should be. Now position your caret on column 80 (according to the status bar) and look at the ruler--the cursor marker is on 79, but the status bar says 80--very confusing!! Move your caret to column 81, and now your cursor-marker line and your right-margin line correspond--both are on 80!

Now move your cursor to column 1--the status bar says 1, but the ruler says 0!!

The same thing happens with column markers--set column marks to 5, 10, and 20. The marker lines appear at 5, 10, and 20 on the ruler--which is correct. But now jump left and right through the column marks, and when your cursor is on 5, 10, 20 (the the cursor-marker line corresponds with the column markers under 5,10, 20), the status bar says 6, 11, 21!!

Is this as confusing to you as to me? There may be different solutions; what do you think? My thoughts:
A. There are already hotkeys to toggle on/off the folding-bar and the line-numbers. Could we please have a hotkey to toggle on/off the whole gutter (like the option in user.json)?

B. Now with the gutter on, and the folding-bar on, there is a vertical line in the gutter--the folding-bar.

C. In your code, shift the ruler line to the left, so that the '0' is over the folding-bar, and the '1' is over the first text column. Now when the cursor is in column 1 according to the status bar, the cursor-marker will also be under the 1 on the ruler bar, and all the other markers will properly align. So far, so good.

D. What happens when the folding-bar is turned off? The '0' in the ruler bar moves above that vertical space in the gutter that shows which lines have been changed. This may be acceptable.

E. What happens when the whole gutter is turned off? Now the '0' in the ruler line will be either hidden by the side panel (if it is on), or be off-screen (if side panel is off), and the '1' marker on the ruler will be at the edge.

F. Solution: Remove the '0' from the ruler altogether, make the ruler start with column 1, and place a '1' over that first mark on the ruler. I know that when coding, we love base-0 code (start array indexes at 0, etc.). But think about it: when writing, there is no such thing as column '0'--the first column is always column 1. This base-0 vs. base-1 is the difference between coding and using the editor. This would really alleviate a lot of confusion. And lest someone should say that the ruler is ugly, he would soon get used to it. But you could always provide an option to allow the ruler to start with 1 or with 0. What do you think?
qwerky
Posts: 172
Joined: 21.10.2013 00:58

Post by qwerky »

What do you think about making the Ruler line start at 1 instead of 0 (maybe an option?) so that the ruler and the status bar line up?
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

OK, but if other editors do the same, from 1. PSPad shows from 0. :)
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

Added opt

//Ruler: start numeration from 1 (otherwise from 0)
"ruler_from_1": false,
Post Reply