Page 1 of 2
method to fill the background color in document window
Posted: 16.01.2024 00:45
by SamC
Hello,
I want to write a small plugin to change the background color of certain lines of the markdown file for focus view.(like the bookmark,can change the backgroud color of one entire line)
Please give some advise about which api should be used?
BTW, what dose the line in box in the picture below mean?
- 2024-01-16_09-29-21.png (690 Bytes) Viewed 5818 times
Thanks!
Re: method to fill the background color in document window
Posted: 16.01.2024 05:05
by main Alexey
- plugin Focus Mode exists
- colored line means the
https://wiki.freepascal.org/CudaText#Line_states
- API 1: ed.set_prop() with id PROP_MARKED_RANGE: 2-tuple with line indexes of "marked range"; (-1, -1) if range not set.
- API 2: ed.attr()
Re: method to fill the background color in document window
Posted: 16.01.2024 06:12
by main Alexey
- API 3 (AFAIR, what the Focus Mode plugin uses): ed.dim()
Re: method to fill the background color in document window
Posted: 16.01.2024 06:14
by SamC
Thanks, ed.set_prop() seems more simple to use,the default color is light blue,may I change it to light yellow?
Re: method to fill the background color in document window
Posted: 16.01.2024 06:50
by main Alexey
It is ui-theme color:
editor, marked range BG
Re: method to fill the background color in document window
Posted: 16.01.2024 06:53
by SamC
Got it, thanks~
Re: method to fill the background color in document window
Posted: 23.01.2024 01:41
by SamC
Hello,
For the background color,I find in the code block of markdown,the background color will lose in empty row,but when not in the code block,the empty row will also be filled. How to also fill the empty row in code block by PROP_MARKED_RANGE?
Thanks!
what the editor looks like by:ed.set_prop(PROP_MARKED_RANGE,(0,9))
- Snipaste_2024-01-23_09-38-53.png (9.67 KiB) Viewed 5785 times
what the editor looks like by:ed.set_prop(PROP_MARKED_RANGE,(10,21))
- Snipaste_2024-01-23_09-41-03.png (11.33 KiB) Viewed 5785 times
Re: method to fill the background color in document window
Posted: 23.01.2024 07:23
by main Alexey
seems I fixed this now. here is fixed beta for windows/linux, pls test:
https://github.com/Alexey-T/CudaText/issues/5377
Re: method to fill the background color in document window
Posted: 23.01.2024 08:08
by SamC
I over written the /data and cuda main program.
The marked range is with no more empty rows. But it seems the original background color in codeblock is disappeared now.
Also, the lexer styles mapping I set seems be reset. Where did it be stored in file?
Re: method to fill the background color in document window
Posted: 23.01.2024 09:45
by main Alexey
ops, I made regression in Markdown lexer.
download fixed lexer
https://raw.githubusercontent.com/Alexe ... rkdown.lcf
and put file to 'data/lexlib'.