Alexey-T / CudaText

Cross-platform text editor, written in Free Pascal
Mozilla Public License 2.0
2.54k stars 174 forks source link

Hope to add a feature to adjust the margins of the editing area. #5762

Closed FanNengHu closed 3 weeks ago

FanNengHu commented 3 weeks ago

Could you please add a feature that allows adjusting the margins of the text editing area? For example, I would like to have more space on the left side for the text, similar to the effect shown below. Thank you!

animate

Alexey-T commented 3 weeks ago

I added option "gutter_width_empty" (default is 2 pixels). will be in 1.129. e.g. if i change it to 30 editor will look so, big indent lefter of text:

Screenshot from 2024-11-03 12-57-40

it's ok?

FanNengHu commented 3 weeks ago

This option is great! It would be even better if I could set both left and right margins simultaneously. When I turn on the wrap mode, the distance between the text and the right edge is still too wide, so being able to adjust the right margin would be a great improvement.

Additionally, I've noticed a small issue: when the wrap mode is enabled, only the last line of a paragraph shows the background color, while the background color of the previous lines disappears.

Thank you for your hard work, I appreciate it!

Snipaste_2024-11-03_18-03-33

Alexey-T commented 3 weeks ago

indent on right is 1-char for me. maybe it's 1 char for you too, if you reduce width by n pixels?

Screenshot from 2024-11-03 13-11-43

also you have option "margin" to INCREASE this indent.

when the wrap mode is enabled, only the last line of a paragraph shows the background color, while the background color of the previous lines disappears.

try this option Screenshot from 2024-11-03 13-13-20

FanNengHu commented 3 weeks ago

Yes, if I continue to reduce the width, I can indeed achieve a one-character distance on the right side.

and The issue with the background color of the current line has also been resolved according to your settings. Thank you!

Additionally, the method you mentioned of using the margin option to change the right margin does work, but it is not particularly flexible and creates a black line. Once the window is resized to the left of the margin, the right margin still remains at a distance of one character. What I mean by the right margin is that it should maintain a set value regardless of how the window is resized.

For example, if I want to maximize the CudaText window but only edit within a small area in the center of the screen (which would create a more immersive experience), I would need an option to adjust the margins of the text editing area on the top, bottom, left, and right.Just like the image displayed below.

56565656

Alexey-T commented 3 weeks ago
FanNengHu commented 3 weeks ago

The centering_width does indeed allow for significant margin adjustments,However, the downside is that the distance changed by this option will still vary with the resizing of the window. I still hope to implement an option to set both left and right margins simultaneously, with a size that does not change when the window is resized.

From a practical perspective, having the gutter_width_empty option along with the centering_width option is sufficient. It makes sense not to implement "adjust the top and bottom margins" since not many people would use this functionality.

Currently, the gutter_width_empty option allows for adjustment of the left margin in the text area, which is already great. If possible, I hope to see the addition of right margin adjustment in future plans.

Thank you for your efforts!

Alexey-T commented 3 weeks ago

1.219 is released, so pls download and test new options which we discussed.

Alexey-T commented 3 weeks ago

If possible, I hope to see the addition of right margin adjustment in future plans.

I guess the option "margin" - if set to small value - is doing this. then you must activate word-wrap at margin of course (NOT at window edge). "wrap_mode": 2 in user.json.

FanNengHu commented 3 weeks ago

Thank you for the new version. After testing, the gutter_width_empty option works very well—once I set a value, it does not change when I resize the window, which is great.

I can indeed use the margin and wrap_mode:2 options to achieve the right margin I want. However, the drawback is that the right margin is not fixed; it changes with the size of the window. Additionally, there is an unavoidable black vertical line.

The following two images are a comparison between CudaText and Notepad++ regarding this feature.

Notepad++ allows you to set the distance values for the left and right margins separately, and once set, these values remain consistent regardless of how the window size changes.

Additionally, I actually think that the right margin adjustment feature doesn't necessarily need to be implemented. Currently, being able to adjust the left margin is sufficient; it's just that for perfectionists, having the ability to adjust both left and right margins would be even better.

ct np