diff options
| author | bors <bors@rust-lang.org> | 2015-07-01 16:21:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-07-01 16:21:10 +0000 |
| commit | 9d67b9f0f90a43e822d09201291603fc0f7601b3 (patch) | |
| tree | eea50ea481ceb11b276bcd42402aa7481eaab3fd /src/libstd/sys/unix/stack_overflow.rs | |
| parent | d4fe2a00276fa14a526409ccaee740ba01a17f3e (diff) | |
| parent | 49b73e46d68f96e8afc8346c5d3a0ccb38f7c634 (diff) | |
| download | rust-9d67b9f0f90a43e822d09201291603fc0f7601b3.tar.gz rust-9d67b9f0f90a43e822d09201291603fc0f7601b3.zip | |
Auto merge of #26675 - azerupi:doc-js-keyevent, r=alexcrichton
Like explained in #26016, typing `?` had no effect with non-english keyboard layouts in the docs.
This patch seems to resolve this issue, **tested with AZERTY keyboard in Google Chrome and Firefox**. I haven't tested it with more exotic keyboard layouts or with other browsers though.
This code is based on the information found on: http://javascript.info/tutorial/keyboard-events
**More specifically:**
> The only event which reliably provides the character is keypress.
**And**
>```
// event.type must be keypress
function getChar(event) {
if (event.which == null) {
return String.fromCharCode(event.keyCode) // IE
} else if (event.which!=0 && event.charCode!=0) {
return String.fromCharCode(event.which) // the rest
} else {
return null // special key
}
}
```
`?` and `S` work, `escape` however does not (on an Azerty keyboard).
It would be good if some people could test it with other browsers and keyboard layouts: http://www.mathieudavid.org/test/rustdoc/std/index.html
**Edit:**
- swedish layout works on Firefox and Chromium
- french (azerty) mac layout works on Safari
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
