Skip to content

Writing in R // R 4.2.0 on Windows doesn't work with Dasher

24 messages · Ivan Krylov, Paulo Barata, Kasper Daniel Hansen +4 more

#
To the R developers,

I would like to point out an issue that occurs with the new R 4.2.0 
running on Windows; this is possibly related to the recent wide changes 
made to the Windows port of R. The issue has to do with writing of the R 
window.

My computer runs on Windows 10 Professional 64-bit with all the latest 
updates, and has a 4-core 8-thread Intel Xeon processor with 32 Gb of RAM.

I have some slight impairment in my hands, so for typing I avoid using 
the computer keyboard as much as possible. For most of my typing, I use 
the software Dasher, a kind of assistive technology software. Dasher was 
created by the Inference Group led by Professor David MacKay (died in 
2016) at Cambridge University in England. Later, Dasher was further 
developed by Ada Majorek (a Google engineer, recently deceased).

General information on Dasher and about the Dasher Project can be found 
on the Inference Group page:

http://www.inference.org.uk/dasher/

An example of Dasher in action can be seen on this 2-minute YouTube video:

https://www.youtube.com/watch?v=nr3s4613DX8

An one-hour YouTube video of a 2007 Google Talk by Professor MacKay 
himself explaining the Dasher concept can be found here:

https://www.youtube.com/watch?v=wpOxbesRNBc

In the 2-minute video (the first YouTube address above), the sentence 
written through Dasher, for actual use, needs to be copied and then 
pasted into another software, say a text editor. But Dasher also has a 
"Direct Entry" mode, where words typed are entered directly on the 
screen of the text editor or other software -- this is how I use Dasher 
to write on the R window.

Using Dasher`s "Direct Entry" mode, for all effects, to write a word 
through Dasher works exactly like writing the word through the normal 
computer keyboard. Somehow (I do not know about system programming), in 
"Direct Entry" mode, the output of Dasher is understood by the computer 
as an input of the same nature as a keyboard input.

But this is the issue: until R 4.1.3, R accepted normally the 
word-typing through Dasher. But R 4.2.0 (and R 4.2.0-patched build 
r82348, 12 May 2022) does not accept Dasher anymore.

So, for now, if I wish to use R during some extended interactive section 
(say, for a first look at a complex data set), and if I wish to use 
Dasher for this interactive session, then I have to use R 4.1.3. For 
using R through programming, I can use the new R 4.2.0, by writing the 
program with Dasher in my text editor, and then pasting that program into R.

The latest Windows version of Dasher, version 5.0.0 beta, works 
perfectly well with text editors (I use EditPad Pro), with 
Microsoft-like Office packages (I use SoftMaker Office), for writing 
e-mails (I use Mozilla Thunderbird), for writing on a web page (I use 
mostly Mozilla Firefox). It worked perfectly well with R up to version 
4.1.3, but it does not work with R 4.2.0

The latest Dasher 5.0.0 beta Windows installer and the source code can 
be found on this page below (please click on "Windows installer" and on 
"source code", just below the head "Dasher 5.0 beta release"):

https://github.com/dasher-project/dasher/releases

To set Dasher 5.0.0 beta to the "Direct Entry" mode, after installing 
Dasher one should go to Preferences > Application > Application Style.

Currently, after the passing of Ada Majorek, the Dasher Project is being 
put forward by a group of people in England, but, it seems, at a very 
slow pace. They have announced the existence of a version 6 beta, but 
this is only an online instance of Dasher, there is no Windows 
installer, as far as I know. Their web page:

https://dasher.acecentre.net/

For me, and possibly for other users, the Dasher version 5.0.0 beta for 
Windows that is available works perfectly well, and allows me to use the 
computer with a proficiency that would be hardly possible otherwise.

Here I request that the R developers take a look at this word-typing 
issue that happens with the new R 4.2.0 on Windows.

As an R user (I work in ecological research), I can only thank the R 
team for this really wonderful piece of statistical software that you 
make freely available to us all.

Regards,

Paulo Barata

(Rio de Janeiro - Brazil)
1 day later
#
To the R developers,

I noticed today that R 4.2.0 responds to the "Enter" character of Dasher 
version 5.0.0 beta in "Direct Entry" mode. An "Enter" in Dasher causes 
the R prompt to jump to the next line, as an "Enter" should do.

No other characters (letters, digits, special characters like + = & ~ | 
# $) are accepted by R 4.2.0 through Dasher.

The "Enter" shows that, somehow, the communication between Dasher and R 
4.2.0 through the Windows system is not completely curtailed.

Regards,

Paulo Barata

----------------------------------------------------------
On 13/05/2022 16:44, Paulo Barata wrote:
#
On Sun, 15 May 2022 11:10:49 -0300
Paulo Barata <pb at infolink.com.br> wrote:

            
This seems to be very similar to the problem discussed here:
https://stat.ethz.ch/pipermail/r-devel/2022-May/081683.html

For the record, here's the part of Dasher responsible for "Direct
Entry" on Windows:
https://github.com/dasher-project/dasher/blob/0ec7d646dbaadf06b8eebfc11b784738a20e75af/Src/Win32/Widgets/Edit.cpp#L302

MSDN says:
<https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-keybdinput>

Previously, Tomas Kalibera has mentioned:
I think that for a combination of R >= 4.2 and Dasher, this means an
impasse. Either Dasher should be taught to send WM_IME_COMPOSITION
messages to R (?), or R should learn to understand WM_CHAR messages in
its Unicode windows in addition to WM_IME_COMPOSITION it currently uses.
#
Mr. Krylov,

Thank you very much for you message. Yes, the Dasher issue seems to have 
some common ground with the other R 4.2.0 issue you have pointed out.

As I said, I know nothing about system programming, so I cannot 
contribute to a solution to these problems. I only stress that, as I 
said, Dasher 5.0.0 beta in "Direct Entry" mode works perfectly well with 
all the other software I use: e-mail, text editors, Internet browsers, 
etc., all of them with the latest updates, as it happens with my Windows 
10 Professional. Dasher works well with Windows' File Explorer, Windows' 
Notepad, and Windows' Command Prompt.

Thank you once again.

Best regards,

Paulo

----------------------------------------------------------
On 15/05/2022 11:58, Ivan Krylov wrote:
#
On 15/05/2022 10:58 a.m., Ivan Krylov wrote:
As far as I can see, Graphapp never looks for VK_PACKET.
Another possible solution for Paulo is to use R via some other front end 
besides RGui, e.g. RStudio, but there are other possibilities too.

Duncan Murdoch
#
Following Mr. Murdoch's suggestion, I installed R Studio (2022.02.2 
build 485) on my Windows 10 Professional.

When opening R Studio, it showed R 4.2.0 patched, the most recent 
version of R I had installed here. As it happens with the standalone R 
4.2.0, Dasher did not work with R Studio with that version of R -- 
please see below what happened.

I unistalled R 4.2.0 patched and also R 4.2.0, so then my latest version 
of R was R 4.1.3 patched. This was now the version of R that R Studio 
used. Dasher also did not work in R Studio with R 4.1.3 patched -- 
please see below what happened. Please note that the standalone R 4.1.3 
patched does work perfectly well with Dasher.

What happens in R Studio with both R 4.2.0 patched and R 4.1.3 patched: 
when I open R studio and start writing with Dasher, the first character 
that I write is now the character that always appears on the R Studio 
console, no matter what other characters I am commanding with Dasher. 
For R Studio, strangely, Dasher seems to be stuck in the first character.

For example, if I wish to write a plot command in R Studio, the first 
Dasher "p" is accepted by R Studio, but the next "lot" appears on the R 
Studio console as "ppp". This is is contrast with what happens with 
Dasher on R 4.2.0, where, except for the "Enter" character, no other 
character is accepted by R 4.2.0, the R 4.2.0 screen just does not 
respond to Dasher.

Both in R 4.2.0 and in R Studio, the "Enter" character of Dasher work 
well, it makes the R prompt to jump to the next line.

So, Dasher does not work with R Studio either, but in a different way 
than it happens with R 4.2.0.

Regards,

Paulo Barata

----------------------------------------------------------
Paulo Barata
Rua Almirante Alexandrino 1808 apt. 102
Santa Teresa
20241-263  Rio de Janeiro - RJ

Paulo Barata
Sub-S?ndico - Condom?nio do Edif?cio Dois Irm?os
Rua Almirante Alexandrino 1808 - Santa Teresa

E-mail: pb at infolink.com.br
----------------------------------------------------------
On 15/05/2022 13:27, Duncan Murdoch wrote:
#
On 15/05/2022 1:09 p.m., Paulo Barata wrote:
That's too bad.  Still, there are other front ends:

- Running Rterm in a command window.

- R in Visual Studio Code

- ESS in Emacs

- Others whose names I don't remember; not sure how active any of them 
are these days.

And finally, if you are really desperate, I believe dasher runs on other 
platforms besides Windows, i.e. Linux and MacOS.

Duncan Murdoch
#
Mr. Murdoch,

Yes, following your suggestion, I see that I can use Dasher with R 4.2.0 
patched in Visual Studio Code. Dasher works well that way, Visual Studio 
Code does accept Dasher, so I can use Dasher with R in an interactive 
mode. I will have to understand better the workings of Visual Studio Code.

As an alternative, I will keep here two different versions of R: R 4.1.3 
for interactive use through Dasher, and R 4.2.0 for running programs 
(written by means of a text editor).

Anyway, I hope that some technical way can be found so that Dasher can 
be used regularly on the R console in R versions following R 4.2.0.

For your information, Dasher can be used on Windows and Linux, but 
currently not on Macs.

Best regards,

Paulo Barata

----------------------------------------------------------
On 15/05/2022 14:24, Duncan Murdoch wrote:
#
I don't know if there's a good up-to-date list anywhere of 
editors/IDEs that handle R nicely, but it would include at least:

   Atom
   Sublime Text
   VS Code
   RStudio
   Jupyter notebooks
   vim
   emacs
   Tinn-R

   It's worth being able to choose from such a list both for general 
aesthetic preferences, and for those with accessibility challenges.

  I do agree that it would be nice if there were a way to make the R 
console work well with Dasher under Windows, but the technical details 
are completely beyond me.
On 2022-05-15 2:28 p.m., Paulo Barata wrote:

  
    
#
On 15/05/2022 2:44 p.m., Ben Bolker wrote:
One more that I should have mentioned:  StatET, a plug-in for the 
Eclipse IDE.
A long time ago I used to know some of this stuff, but now I find 
working in Windows quite difficult.  I never knew it well enough to know 
the advantages and disadvantages of the approach RGui uses versus the 
one that dasher seems to be expecting.

On the hopeful side, accessibility has always had a relatively high 
priority in the R Project, and there seems to be a recent push in that 
direction.  Perhaps there will be an opportunity for someone to bring up 
this issue at useR! 2022 (https://user2022.r-project.org).

Duncan Murdoch
#
It is interesting that Paulo reports Rgui to behave differently from many
(all?) other applications. However, I have no insight into Windows.

Best,
Kasper

On Sun, May 15, 2022 at 3:32 PM Duncan Murdoch <murdoch.duncan at gmail.com>
wrote:

  
    
#
On 15/05/2022 5:01 p.m., Kasper Daniel Hansen wrote:
It's not a big surprise.  Rgui uses a UI library (Graphapp) that was 
written a very long time ago, and it hasn't adopted their updates in at 
least 15 years.  Additionally, Rgui hasn't really had any Windows users 
giving it the attention it needs.

And not nearly "all".  RStudio has different problems, which means 
everyone using the same UI library they use probably has them too.  I 
didn't see any open source projects in the list of things that work.

Duncan Murdoch
#
VScode is sorta-kinda open source 
https://opensource.com/article/20/6/open-source-alternatives-vs-code 
(that is, the default downloadable binaries are non-freely licensed). 
Presumably the open builds also work.

   On the other hand, it's also developed by Microsoft, so it's not much 
of a surprise that it works better on Windows than some of the alternatives.
On 2022-05-15 5:48 p.m., Duncan Murdoch wrote:

  
    
#
Mr. Murdoch,

Two pieces of open source software that do work with Dasher 5.0.0 beta 
in Direct Entry mode, on Windows 10:

---------

Apache Open Office 4.1.2 (32-bit Windows application) -- I tried the 
Open Office Writer, a Microsoft Word equivalent:

https://sourceforge.net/projects/openofficeorg.mirror/

Source code here:

https://openoffice.apache.org/source.html

---------

Notepad++ 8.4.1 (64-bit Windows application / text editor):

https://notepad-plus-plus.org/downloads/v8.4.1/

Source code here:

https://github.com/notepad-plus-plus/notepad-plus-plus

---------

Best regards,

Paulo Barata

----------------------------------------------------------
On 15/05/2022 18:48, Duncan Murdoch wrote:
#
On 15/05/2022 6:28 p.m., Paulo Barata wrote:
That's very helpful, for two reasons.

1.  Maybe Notepad++ can replace Rgui as an environment for you to work 
in, since it claims to support R.  I've never used it, so I don't know 
exactly what level of support is offered, but maybe it's enough for your 
needs at least in the short term.

2.  Others who may be planning to fix Rgui can see how it handles input 
coming from dasher, and get Rgui to do the same thing.

Duncan Murdoch
#
I use Notepad++ all the time. Last time I tried to install the plug-in 
which lets you run R my anti-virus complained so I abandoned at that 
point but Paulo's experience may be different and it was a few years ago 
so the plug-in or my anti-virus may have changed since (I suspect it was 
a false positive).

Michael
On 16/05/2022 10:04, Duncan Murdoch wrote:

  
    
  
#
On 5/15/22 16:10, Paulo Barata wrote:
Dear Paulo,

thanks for the report and thanks to all for the useful comments in the 
followup discussion. I've committed a fix to R-devel, 82368, and I would 
be grateful if you could test whether it fixes the problem for you. I've 
tested it only on a small example which is using the same method to 
insert keys to Rgui as Dasher does.

The problem is caused by a limitation in GraphApp, a library used by 
Rgui and included in the R distribution. GraphApp has two modes: Unicode 
windows (with this limitation) and non-Unicode windows (without it). 
GraphApp uses Unicode windows when running in a multi-byte locale, and 
as of R 4.2, this is the case for all systems on recent Windows where 
the native encoding is UTF-8. This means that most likely R 4.1.3 didn't 
work with Dasher on systems running in a multi-byte locale and that most 
likely R 4.2.0 would work with Dasher on old Windows systems (where 
UTF-8 cannot be used as native encoding).

Dasher uses SendInput/KEYEVENTF_UNICODE to inject text into Rgui, which 
is fine as far as I can tell and should work. It didn't work, because 
the Unicode windows didn't handle WM_CHAR nor WM_KEYDOWN/WM_KEYUP for 
VK_PACKET. By design, Unicode windows get input via WM_IME_COMPOSITION 
and WM_KEYDOWN, so I've added support for VK_PACKET to WM_KEYDOWN 
(taking the logic in gdk as an example).

I am cc'ing Jose as Tinn-R has a similar problem, though this patch 
doesn't solve it.

Best
Tomas
#
Dear Tomas,

Thank you very much for dealing with this issue.

You said: "I've committed a fix to R-devel, 82368". It happens that, at 
this very moment (Monday 16 May 18:44 UTC), The R-devel that exists on 
both the Austria and the 0-Cloud CRAN pages is this, with a different 
(smaller) number:

This is a Windows 64 bit binary build of the 2022-05-15 r82362 
development snapshot of R

Anyway, I installed and tried this R-devel r82362, and Dasher does not 
work with it.

I am not able to find R-Devel 82368 on the CRAN site. Maybe I should 
wait a little more. Or maybe you could send me a proper link to that.

Best regards,

Paulo Barata

----------------------------------------------------------
On 16/05/2022 14:08, Tomas Kalibera wrote:
#
On 5/16/22 19:45, Paulo Barata wrote:
Thanks, Paulo, yes,? it needs to be a version >= 82368 (and it may take 
several hours to appear), but at least you have now a baseline negative 
test using R-devel.

Best
Tomas
#
You'll probably have to wait a day or so for a new build.  The 
Windows binaries are only built once a day or so.

https://cran.r-project.org/bin/windows/base/rdevel.html was built on 
2022-05-15.

   Tomas's fix was only committed an hour ago:

https://github.com/wch/r-source/commit/9b6de510e6346da7ccb582d14a7699500751efc4

   If you're really eager you can install Subversion and build from 
source <https://developer.r-project.org/SVNtips.html> (or clone the 
Github mirror etc.).

   cheers
    Ben Bolker
On 2022-05-16 1:45 p.m., Paulo Barata wrote:

  
    
#
On 16/05/2022 1:51 p.m., Ben Bolker wrote:
They appear first at

https://cran.r-project.org/bin/windows/base/rdevel.html

and are mirrored to other sites later.

Duncan Murdoch
#
Dear Tomas,

Great news! I downloaded R-devel 2022-05-16 r82368 for Windows and 
installed it on my Windows 10 Professional. It works perfectly well with 
Dasher 5.0 beta!

In Dasher, I tried all special characters like $ & | *, many small and 
capital letters, including some accented ones like ? ? ? ? that exist in 
Portuguese (and other languages, e.g. French (there are versions of 
Dasher for many languages)), all digits, space, the Enter character and 
the "Backspace" movement (to erase previously written characters), 
everything works well.

Now, we can fully use Dasher in the R console.

It seems that we cannot yet normally install packages in this R-devel 
r82368. So I look forward to the day when a stable R 4.3.0 will be 
available. Meanwhile, for my ecological work, I can use R perfectly well 
with the versions 4.1.3 and 4.2.0 that I have here, so, from my 
viewpoint, this R 4.3.0 can take its time to come to light.

I can only thank you very much, and all the other people who took part 
in this discussion, for the quick fix to this issue.

Best regards,

Paulo Barata

(Rio de Janeiro - Brazil)

----------------------------------------------------------
On 16/05/2022 14:08, Tomas Kalibera wrote:
#
Dear Paulo,
On 5/17/22 15:04, Paulo Barata wrote:
I am happy it works again, thanks for the testing and the report. I've 
ported the fix to R-patched, which means it will appear in R 4.2.1.
R 4.3.0 will be released probably around next April, but R 4.2.1 much 
sooner (expect in 1-3 months, though this hasn't been scheduled, yet). 
Before that, you should be able to use an R-patched snapshot build 
available from

https://cran.r-project.org/bin/windows/base/rpatched.html

but only after the build is of release >= 82371 (which should happen by 
tomorrow - the page shows the revision number). R-patched is R 4.2.0 
with updates that will eventually become 4.2.1, so should be more stable 
than R-devel is now (to become 4.3.0 around next April).

If you have any problems with installing packages in either version of 
R, please report, so that someone can help or indeed if there is a bug, 
it could be fixed.
Thank you for the report. Without it, the problem wouldn't have been fixed.

Best
Tomas
#
Dear Tomas,

Today, I installed R version 4.2.0 Patched (2022-05-17 r82371 ucrt) on 
my Windows 10 Professional. Dasher works perfectly well with that 
version of R.

Again, using Dasher, I tried special symbols, letters (including 
accented ones), digits, space, the "Enter" character and the "Backspace" 
movement, and I wrote a range of commands in the R language, everything 
worked well.

I could install some packages normally in that version of R, no problems.

I think that the Dasher issue has been solved. I will use this R 4.2.0 
Patched r82371 from now on.

Again, thank you very much, and all the other people who took part in 
this discussion, for all your attention.

Best regards,

Paulo

----------------------------------------------------------
On 17/05/2022 10:45, Tomas Kalibera wrote: