[Lazarus] Lazarus code editor: what happened with the caret?

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Lazarus code editor: what happened with the caret?

Free Pascal - Lazarus mailing list
Hello,
After years, I just built a fresh Lazarus from SVN. I ran the IDE, and
noticed immediately that a code editor is completely unusable to screen
reader. I am running Windows and using NVDA. In the past, the code
editor was partially usable. But now, NVDA is unable to see the caret.
So I would like to ask: is caret drawn in some nonstandard way? Or could
I set any settings in options to try to fix this?
Thanks!

--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus code editor: what happened with the caret?

Free Pascal - Lazarus mailing list
Latest SynEdit uses a custom drawn caret.

This was introduced to enable multiple carets. That is: having several
carets at the same time, to type and edit several locations simultaneously.
(e.g shift-alt down, gives you 2 carets, one in each row)

Since Windows does not allow for more than one caret to be created, it
was necessary to draw them directly.

See components\synedit\synpluginmulticaret.pp
line 1713
   if ScreenCaret.Painter.ClassType = TSynEditScreenCaretPainterSystem then
     ScreenCaret.ChangePainter(TSynEditScreenCaretPainterInternal);

Comment this out. (multicaret will not work / only one caret will be
visible).

Or change
components\synedit\syneditpointclasses.pas
line 3085
TSynEditScreenCaret.ChangePainter
to always set  TSynEditScreenCaretPainterSystem

On 06/10/2017 20:57, Lubos Pintes via Lazarus wrote:
> Hello,
> After years, I just built a fresh Lazarus from SVN. I ran the IDE, and
> noticed immediately that a code editor is completely unusable to
> screen reader. I am running Windows and using NVDA. In the past, the
> code editor was partially usable. But now, NVDA is unable to see the
> caret.
> So I would like to ask: is caret drawn in some nonstandard way? Or
> could I set any settings in options to try to fix this?
>


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus code editor: what happened with the caret?

Free Pascal - Lazarus mailing list

Thank you very much for information, I will try it.

Dňa 6. 10. 2017 o 22:43 Martin Frb via Lazarus napísal(a):

> Latest SynEdit uses a custom drawn caret.
>
> This was introduced to enable multiple carets. That is: having several
> carets at the same time, to type and edit several locations simultaneously.
> (e.g shift-alt down, gives you 2 carets, one in each row)
>
> Since Windows does not allow for more than one caret to be created, it
> was necessary to draw them directly.
>
> See components\synedit\synpluginmulticaret.pp
> line 1713
>    if ScreenCaret.Painter.ClassType = TSynEditScreenCaretPainterSystem then
>      ScreenCaret.ChangePainter(TSynEditScreenCaretPainterInternal);
>
> Comment this out. (multicaret will not work / only one caret will be
> visible).
>
> Or change
> components\synedit\syneditpointclasses.pas
> line 3085
> TSynEditScreenCaret.ChangePainter
> to always set  TSynEditScreenCaretPainterSystem
>
> On 06/10/2017 20:57, Lubos Pintes via Lazarus wrote:
>> Hello,
>> After years, I just built a fresh Lazarus from SVN. I ran the IDE, and
>> noticed immediately that a code editor is completely unusable to
>> screen reader. I am running Windows and using NVDA. In the past, the
>> code editor was partially usable. But now, NVDA is unable to see the
>> caret.
>> So I would like to ask: is caret drawn in some nonstandard way? Or
>> could I set any settings in options to try to fix this?
>>
>
>


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus code editor: what happened with the caret?

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
Hello,
One of your suggested changes indeed showed a system caret, but there is
probably another change, because the NVDA is unable to show me lines
after I scrool with a down arrow to try to read the contents. But that
may be a NVDA problem.
For now I will use external editor for editing and special IDE features
like code completion directly in the environment.
I now have another question, a bit unrelated to this thread but relevant
for me. If I make a change like this, I obviously need to rebuild the
IDE. Currently I am using the command
lazbuild --build-ide= -q -q
Can someone perhaps suggest a better command, another parameters for
example? I am not sure if that is totally correct. I will then save the
command to b.bat to make rebuilds easier.

Thanks

Dňa 6. 10. 2017 o 22:43 Martin Frb via Lazarus napísal(a):

> Latest SynEdit uses a custom drawn caret.
>
> This was introduced to enable multiple carets. That is: having several
> carets at the same time, to type and edit several locations simultaneously.
> (e.g shift-alt down, gives you 2 carets, one in each row)
>
> Since Windows does not allow for more than one caret to be created, it
> was necessary to draw them directly.
>
> See components\synedit\synpluginmulticaret.pp
> line 1713
>    if ScreenCaret.Painter.ClassType = TSynEditScreenCaretPainterSystem then
>      ScreenCaret.ChangePainter(TSynEditScreenCaretPainterInternal);
>
> Comment this out. (multicaret will not work / only one caret will be
> visible).
>
> Or change
> components\synedit\syneditpointclasses.pas
> line 3085
> TSynEditScreenCaret.ChangePainter
> to always set  TSynEditScreenCaretPainterSystem
>
> On 06/10/2017 20:57, Lubos Pintes via Lazarus wrote:
>> Hello,
>> After years, I just built a fresh Lazarus from SVN. I ran the IDE, and
>> noticed immediately that a code editor is completely unusable to
>> screen reader. I am running Windows and using NVDA. In the past, the
>> code editor was partially usable. But now, NVDA is unable to see the
>> caret.
>> So I would like to ask: is caret drawn in some nonstandard way? Or
>> could I set any settings in options to try to fix this?
>>
>
>


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus code editor: what happened with the caret?

Free Pascal - Lazarus mailing list
To rebuild the IDE, open the Tools Menu.

2nd last entry: "Build Lazarus ... profile name"

Or last entry "Configure build lazarus" which opens a dialog, so you can
specify compiler options.

How does NVDA read the content of a control? Does it do OCR?
Because SynEdit is entirely custom drawn. SynEdit does not expose it's
text through any API.

If it is OCR, maybe it helps to switch SynEdit to black and white.
(Tools: Options, then Editor, Colors / But you have to switch of each
color by itself.
Also make sure you go to the config for "Markup and Matches" and disable
everything there. (Especially the new option "Outline (global)"

If it is an issue with scrolling: Try compiling with the option
-dSynNewScrollBarUpdate


On 07/10/2017 09:01, Lubos Pintes via Lazarus wrote:

> Hello,
> One of your suggested changes indeed showed a system caret, but there
> is probably another change, because the NVDA is unable to show me
> lines after I scrool with a down arrow to try to read the contents.
> But that may be a NVDA problem.
> For now I will use external editor for editing and special IDE
> features like code completion directly in the environment.
> I now have another question, a bit unrelated to this thread but
> relevant for me. If I make a change like this, I obviously need to
> rebuild the IDE. Currently I am using the command
> lazbuild --build-ide= -q -q
> Can someone perhaps suggest a better command, another parameters for
> example? I am not sure if that is totally correct. I will then save
> the command to b.bat to make rebuilds easier.
>

--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus code editor: what happened with the caret?

Free Pascal - Lazarus mailing list
Hello and thank for info. NVDA uses screen scraping, it hooks Windows
API like ExtTextOut, TextOut, etc. This rarely works well, and it is
used as a last chance when everything else fails.
Also there is an OCR, but it is only for static things, i.e. take a
snapshot of window and OCR it. So for example an inaccessible installer
can be used quite well, but something as dynamic as edit text area
cannot, at least now.
Dňa 7. 10. 2017 o 16:12 Martin Frb via Lazarus napísal(a):

> To rebuild the IDE, open the Tools Menu.
>
> 2nd last entry: "Build Lazarus ... profile name"
>
> Or last entry "Configure build lazarus" which opens a dialog, so you can
> specify compiler options.
>
> How does NVDA read the content of a control? Does it do OCR?
> Because SynEdit is entirely custom drawn. SynEdit does not expose it's
> text through any API.
>
> If it is OCR, maybe it helps to switch SynEdit to black and white.
> (Tools: Options, then Editor, Colors / But you have to switch of each
> color by itself.
> Also make sure you go to the config for "Markup and Matches" and disable
> everything there. (Especially the new option "Outline (global)"
>
> If it is an issue with scrolling: Try compiling with the option
> -dSynNewScrollBarUpdate
>
>
> On 07/10/2017 09:01, Lubos Pintes via Lazarus wrote:
>> Hello,
>> One of your suggested changes indeed showed a system caret, but there
>> is probably another change, because the NVDA is unable to show me
>> lines after I scrool with a down arrow to try to read the contents.
>> But that may be a NVDA problem.
>> For now I will use external editor for editing and special IDE
>> features like code completion directly in the environment.
>> I now have another question, a bit unrelated to this thread but
>> relevant for me. If I make a change like this, I obviously need to
>> rebuild the IDE. Currently I am using the command
>> lazbuild --build-ide= -q -q
>> Can someone perhaps suggest a better command, another parameters for
>> example? I am not sure if that is totally correct. I will then save
>> the command to b.bat to make rebuilds easier.
>>
>


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus code editor: what happened with the caret?

Free Pascal - Lazarus mailing list
Ahh, LCLCheckListBox is also not accessible, so I cannot disable things
there, I have no feedback.
Dňa 7. 10. 2017 o 16:46 Lubos Pintes via Lazarus napísal(a):

> Hello and thank for info. NVDA uses screen scraping, it hooks Windows
> API like ExtTextOut, TextOut, etc. This rarely works well, and it is
> used as a last chance when everything else fails.
> Also there is an OCR, but it is only for static things, i.e. take a
> snapshot of window and OCR it. So for example an inaccessible installer
> can be used quite well, but something as dynamic as edit text area
> cannot, at least now.
> Dňa 7. 10. 2017 o 16:12 Martin Frb via Lazarus napísal(a):
>> To rebuild the IDE, open the Tools Menu.
>>
>> 2nd last entry: "Build Lazarus ... profile name"
>>
>> Or last entry "Configure build lazarus" which opens a dialog, so you
>> can specify compiler options.
>>
>> How does NVDA read the content of a control? Does it do OCR?
>> Because SynEdit is entirely custom drawn. SynEdit does not expose it's
>> text through any API.
>>
>> If it is OCR, maybe it helps to switch SynEdit to black and white.
>> (Tools: Options, then Editor, Colors / But you have to switch of each
>> color by itself.
>> Also make sure you go to the config for "Markup and Matches" and
>> disable everything there. (Especially the new option "Outline (global)"
>>
>> If it is an issue with scrolling: Try compiling with the option
>> -dSynNewScrollBarUpdate
>>
>>
>> On 07/10/2017 09:01, Lubos Pintes via Lazarus wrote:
>>> Hello,
>>> One of your suggested changes indeed showed a system caret, but there
>>> is probably another change, because the NVDA is unable to show me
>>> lines after I scrool with a down arrow to try to read the contents.
>>> But that may be a NVDA problem.
>>> For now I will use external editor for editing and special IDE
>>> features like code completion directly in the environment.
>>> I now have another question, a bit unrelated to this thread but
>>> relevant for me. If I make a change like this, I obviously need to
>>> rebuild the IDE. Currently I am using the command
>>> lazbuild --build-ide= -q -q
>>> Can someone perhaps suggest a better command, another parameters for
>>> example? I am not sure if that is totally correct. I will then save
>>> the command to b.bat to make rebuilds easier.
>>>
>>
>
>


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus code editor: what happened with the caret?

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
If it hooks ExtTextOut, then the color settings will most likely make a
difference.

Each time the color (or text style, e.g. bold) changes, the Editor
interrupts the output, and makes a new call. Also colors change, when
the caret moves, so there is constant redrawing.

I attached a file editoroptions.xml
It has (almost) all colors black and white. Selected text will be bold.

While lazarus is not running, put this file into: (replacing username
with your name / make a backup of the old file)

C:\Users\username\AppData\Local\lazarus\editoroptions.xml

This file also overrides keyboard shortcuts, and mouse settings (in case
you changed any of them).



On 07/10/2017 15:46, Lubos Pintes via Lazarus wrote:
> Hello and thank for info. NVDA uses screen scraping, it hooks Windows
> API like ExtTextOut, TextOut, etc. This rarely works well, and it is
> used as a last chance when everything else fails.
> Also there is an OCR, but it is only for static things, i.e. take a
> snapshot of window and OCR it. So for example an inaccessible
> installer can be used quite well, but something as dynamic as edit
> text area cannot, at least now.


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus

editoroptions.xml (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus code editor: what happened with the caret?

Free Pascal - Lazarus mailing list
This helped a lot, thanks!

Dňa 7. 10. 2017 o 17:25 Martin Frb via Lazarus napísal(a):

> If it hooks ExtTextOut, then the color settings will most likely make a
> difference.
>
> Each time the color (or text style, e.g. bold) changes, the Editor
> interrupts the output, and makes a new call. Also colors change, when
> the caret moves, so there is constant redrawing.
>
> I attached a file editoroptions.xml
> It has (almost) all colors black and white. Selected text will be bold.
>
> While lazarus is not running, put this file into: (replacing username
> with your name / make a backup of the old file)
>
> C:\Users\username\AppData\Local\lazarus\editoroptions.xml
>
> This file also overrides keyboard shortcuts, and mouse settings (in case
> you changed any of them).
>
>
>
> On 07/10/2017 15:46, Lubos Pintes via Lazarus wrote:
>> Hello and thank for info. NVDA uses screen scraping, it hooks Windows
>> API like ExtTextOut, TextOut, etc. This rarely works well, and it is
>> used as a last chance when everything else fails.
>> Also there is an OCR, but it is only for static things, i.e. take a
>> snapshot of window and OCR it. So for example an inaccessible
>> installer can be used quite well, but something as dynamic as edit
>> text area cannot, at least now.
>
>
>


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus code editor: what happened with the caret?

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
About scrolling due to caret moves.

Not sure if my suggestion in the other mail (7 Oct 15:12
SynNewScrollBarUpdate) helped?

If not, I can think of 2 causes.

1) The scrollbar change is not noted. If that is the case, I have no
idea (SynNewScrollBarUpdate does affect this)

2) SynEdit does not redraw all lines, but uses ScrollWindowEx to move
its canvas.
This is very common. I would not expect this to be an issue. Anyway you
can force it to redraw all lines (slower, and more battery if on a laptop)
Go to components\synedit\synedit.pp line 4653 inside procedure
TCustomSynEdit.ScrollAfterTopLineChanged.
the line is currently
       if ScrollWindowEx(Handle, 0, LineHeight * Delta, @srect, @srect,
0, nil, SW_INVALIDATE)
replace it with
       if false


On 07/10/2017 09:01, Lubos Pintes via Lazarus wrote:
> but there is probably another change, because the NVDA is unable to
> show me lines after I scrool with a down arrow to try to read the
> contents. But that may be a NVDA problem.

--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Lazarus code editor: what happened with the caret?

Free Pascal - Lazarus mailing list
Hello Martin,
I didn't try the scrool update fix you requested in another mail,
however I tried the the redraw-all-lines, this will probably help
better, I am currently playing with it.
Thank again for help.
Dňa 9. 10. 2017 o 18:20 Martin Frb via Lazarus napísal(a):

> About scrolling due to caret moves.
>
> Not sure if my suggestion in the other mail (7 Oct 15:12
> SynNewScrollBarUpdate) helped?
>
> If not, I can think of 2 causes.
>
> 1) The scrollbar change is not noted. If that is the case, I have no
> idea (SynNewScrollBarUpdate does affect this)
>
> 2) SynEdit does not redraw all lines, but uses ScrollWindowEx to move
> its canvas.
> This is very common. I would not expect this to be an issue. Anyway you
> can force it to redraw all lines (slower, and more battery if on a laptop)
> Go to components\synedit\synedit.pp line 4653 inside procedure
> TCustomSynEdit.ScrollAfterTopLineChanged.
> the line is currently
>        if ScrollWindowEx(Handle, 0, LineHeight * Delta, @srect, @srect,
> 0, nil, SW_INVALIDATE)
> replace it with
>        if false
>
>
> On 07/10/2017 09:01, Lubos Pintes via Lazarus wrote:
>> but there is probably another change, because the NVDA is unable to
>> show me lines after I scrool with a down arrow to try to read the
>> contents. But that may be a NVDA problem.
>


--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus