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?
Thanks!
method to fill the background color in document window
-
- Posts: 2265
- Joined: 25.08.2021 18:15
Re: method to fill the background color in document window
- 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()
- 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()
-
- Posts: 2265
- Joined: 25.08.2021 18:15
Re: method to fill the background color in document window
- API 3 (AFAIR, what the Focus Mode plugin uses): ed.dim()
Re: method to fill the background color in document window
Thanks, ed.set_prop() seems more simple to use,the default color is light blue,may I change it to light yellow?
-
- Posts: 2265
- Joined: 25.08.2021 18:15
Re: method to fill the background color in document window
It is ui-theme color:
editor, marked range BG
editor, marked range BG
Re: method to fill the background color in document window
Got it, thanks~
Re: method to fill the background color in document window
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)) what the editor looks like by:ed.set_prop(PROP_MARKED_RANGE,(10,21))
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)) what the editor looks like by:ed.set_prop(PROP_MARKED_RANGE,(10,21))
-
- Posts: 2265
- Joined: 25.08.2021 18:15
Re: method to fill the background color in document window
seems I fixed this now. here is fixed beta for windows/linux, pls test:
https://github.com/Alexey-T/CudaText/issues/5377
https://github.com/Alexey-T/CudaText/issues/5377
Re: method to fill the background color in document window
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?
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?
-
- Posts: 2265
- Joined: 25.08.2021 18:15
Re: method to fill the background color in document window
ops, I made regression in Markdown lexer.
download fixed lexer
https://raw.githubusercontent.com/Alexe ... rkdown.lcf
and put file to 'data/lexlib'.
download fixed lexer
https://raw.githubusercontent.com/Alexe ... rkdown.lcf
and put file to 'data/lexlib'.