Alexey-T / CudaText

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

Option to set "scrollbar thumb" and "micromap current view area" minimum size #5451

Closed pintassilgo closed 3 months ago

pintassilgo commented 3 months ago

I realized scrollbar is very hard to see in long documents because thumb color is not that different from background color as it should be: image Can you see the thumb? It's much harder than it should be.

So I tried changing colors for scrollbar items in Settings - theme - ui, but most of them did't work, Then I tried disabling micromap_on_scrollbar and voilà, scrollbar is colored with the colors I chose.

I was already writing a new issue when I realized I must look at micromap, BG and micromap, current view area in Color theme dialog. So micromap replaces scrollbar entirely when you use micromap_on_scrollbar = true, OK.

But one suggestion remains: add an option to set mininum scrollbar thumb height. As you can see in the image above, for long documents the thumb can be very small to the point of being hard to see and to reach it with the mouse. For instance, my OS-painted scrollbar has much bigger minimum height if I turn off scrollbar_themed (KDE Plasma is my DE).

I use micromap on scrollbar, so this proposed new option should also apply to micromap thumb (aka "current view area"). Or, if you don't want to mix these two, I suggest one option for each.

Extra question: what's the purpose of scrollbar, scrolling area in Color theme dialog? While I was testing, I changed it to black just to see where it affects, but I see no black in scrollbar (did this test while micromap on scrollbar was disabled, of course).

Alexey-T commented 3 months ago

Extra question: what's the purpose of scrollbar, scrolling area in Color theme dialog? While I was testing, I changed it to black just to see where it affects, but I see no black in scrollbar

to see it: click and HOLD mouse down below the thumb. to activate page-down scrolling by timer. do you see?

Alexey-T commented 3 months ago

sc

pale green here.

Alexey-T commented 3 months ago

Seems I can do the request. atscrollbar.pas -

    MinSizeToShowThumb:= 10;
    ThumbMinSize:= 8;
    ThumbMarkerOffset:= 3;
    ThumbMarkerMinimalSize:= 20;
    ThumbMarkerDecorSize:= 2;
    ThumbMarkerDecorSpace:= 2;
    ThumbMarkerDecorDouble:= false;

now I must find what here is the needed var..

pintassilgo commented 3 months ago

to see it: click and HOLD mouse down below the thumb. to activate page-down scrolling by timer. do you see?

No, maybe because I use "scrollbar_click_jump": true,.

Alexey-T commented 3 months ago

So you cannot see that color.

pintassilgo commented 3 months ago

Still talking about scrollbar. Is there any reason for the micromap marks not to be centered on scrollbar? It would look better. Currently it's more to the left.

image

Alexey-T commented 3 months ago

yes we have a reason. API allows placing more micromap marks on new columns. also AFAIR(!) the spell checker marks are on different column (not sure)

pintassilgo commented 3 months ago

OK, I just tested disabling scrollbar_click_jump then I saw the color.

pintassilgo commented 3 months ago

API allows placing more micromap marks on new columns

Is there any way to test? image

As you can see, I typed a true word far to the right, but all marks are still aligned to the left, without a single mark to the right as I expected after reading what you said.

pintassilgo commented 3 months ago

Still exploring this subject, is there a way to set a different color for the mark related to the selected word (under caret)?

Alexey-T commented 3 months ago

As you can see, I typed a true word far to the right, but all marks are still aligned to the left, without a single mark to the right as I expected after reading what you said.

It wont work so, marks are always on the left. AFAIR the plugin 'Spell checker' marks are on the right

here are pics from the Wiki. I don't remember how to show marks on the right..

cudatext-micromap_

micromap on bar:

cudatext-micromap-on-scrollbar

mark on the left- 'line states'. in the middle- 'occurs'.

Alexey-T commented 3 months ago

Still exploring this subject, is there a way to set a different color for the mark related to the selected word (under caret)?

yes. maybe it's the 'selection color'? make the selection with 20 lines. you will see selection marks on the RIGHT of micromap

sel2

lite blue here.

Alexey-T commented 3 months ago

You must read - https://wiki.freepascal.org/CudaText#Micromap

pintassilgo commented 3 months ago

OK, I can see line states on the left and selected word on the right. But there are probably two middles, because highlight marks are on "middle-left". Middle-right should be the spellcheck you said, but I don't have this plugin (so if there are only three possible columns - because I don't have spellcheck plugin -, maybe micromap should process 3 cols instead of 4; or maybe the one in the middle should fill both 2 and 3 to be centered).

pintassilgo commented 3 months ago

yes. maybe it's the 'selection color'?

Partially. It doesn't work for HiOccur (word undeer caret, not selection). Suggestion of enhancement for HiOccur. The plugin already has theme_item_current option, but this one is for the highlight the word, not the micromap mark as I'm asking.

Alexey-T commented 3 months ago

OK, I can see line states on the left and selected word on the right. But there are probably two middles, because highlight marks are on "middle-left". Middle-right should be the spellcheck you said, but I don't have this plugin (so if there are only three possible columns - because I don't have spellcheck plugin -, maybe micromap should process 3 cols instead of 4; or maybe the one in the middle should fill both 2 and 3 to be centered).

You arre suggesting only 3 columns. now there are 4 columns. column 3th is always empty for me. I dont remember why I added column 3th.

when micromap is not on the scrollbar, it has 3 columns as you want.

Alexey-T commented 3 months ago

Change made:

I don't want the option here, too many options....

Alexey-T commented 3 months ago

(and the same change - for the scrollbar's thumb: 8->12)

pintassilgo commented 3 months ago

Could you please provide a new beta for me to see the new size?

Alexey-T commented 3 months ago

Beta updated , same folder.

pintassilgo commented 3 months ago

It's better now, thanks. Maybe it should still be bigger. Comparison.

New minimum Cuda scrollbar size - 12px: image

Minimum Firefox scrollbar size - 34px: image

Minimum KDE Plasma scrollbar size - 28px: image

So it's still less than half of these.

Alexey-T commented 3 months ago

Okay, changed to 16. I don't want the option here..

Alexey-T commented 3 months ago

Idea - why micromap-on-scrollbar has 4 cols. IMO it is 3 columns! but code has the limit for each col width. this limit is from 'width of char text cell'. 50% of text cell.

pintassilgo commented 3 months ago

Okay, changed to 16. I don't want the option here..

OK, thanks.

Can I create an issue suggesting to make HighOccur be able to highlight word under caret?

pintassilgo commented 3 months ago

Idea - why micromap-on-scrollbar has 4 cols. IMO it is 3 columns! but code has the limit for each col width. this limit is from 'width of char text cell'. 50% of text cell.

From what I see it's clear:

So if you say micromap has only 3 col, 3rd col shouldn't exist and each one should have 1/3 scrollbar width.

Alexey-T commented 3 months ago

HiOccur has the option for this-- 'options / settings-plugins'. opt is called 'caret_allow'.

pintassilgo commented 3 months ago

HiOccur has the option for this-- 'options / settings-plugins'. opt is called 'caret_allow'.

I use this option, this is not what I'm asking.

I'm saying about the occurrence under the caret to have different mark color compared to the other occurrences in micromap.

pintassilgo commented 3 months ago

Let's say there are 3 occurrences of the word 'null' in the file, in lines 5, 20 and 40.

If i click the word in line 20, I want micromap to display 3 marks, with the one in the middle having a different color from the other two, because it's the one under the caret.

For findbar we already have this using 4th column.

pintassilgo commented 3 months ago

Findbar. If you look carefully to scrollbar, you'll see a light blue at the right of the match in the middle. That's because the word in line 20 is selected after I pressed F3. I propose something similar for HiOccur, so that I can see from scrollbar where is the word under the caret (without having to select it). image

Alexey-T commented 3 months ago

So if you say micromap has only 3 col, 3rd col shouldn't exist and each one should have 1/3 scrollbar width.

Made this better, now almost 1/3 of bar width:

bar2

why almost? maybe 1-2 pixels are lost, border of map.

Alexey-T commented 3 months ago

Ok, make the HiOccur issue - but I don't think it is useful, so try to give the pull-request.

Alexey-T commented 3 months ago

Is this solved now?

I found why micromap columns are not 1/3 width. position of columns are precalculated! for the normal micromap. and then are resused even when map is on the scroolbar.

maybe later I will correct this.