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!
Mailing lists / lazarus / 2017-10
Lazarus code editor: what happened with the caret?
11 messages · 2 people · –
- LLubos Pintes 7
- MMartin Frb 4
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
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
Lubos Pintes wrote 9 lines
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):
Show quoted text 35 lines
Latest SynEdit uses a custom drawn caret. This was introduced to enable multiple carets.…
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):
Show quoted text 35 lines
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
Lubos Pintes wrote 15 lines
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):
Show quoted text 38 lines
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):
Show quoted text 48 lines
Hello and thank for info. NVDA uses screen scraping, it hooks Windows API like…
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).
Lubos Pintes wrote 7 lines
-------------- next part --------------
A non-text attachment was scrubbed...
Name: editoroptions.xml
Type: text/xml
Size: 8033 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20171007/3e1e444d/attachment-0001.xml>
This helped a lot, thanks!
Dňa 7. 10. 2017 o 17:25 Martin Frb via Lazarus napísal(a):
Show quoted text 31 lines
One of your suggested changes indeed showed a system caret, but there is probably another…
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
Lubos Pintes wrotebut 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.
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):
