selection


Rangy expands for cyrillic


I'm using Rangy plugin and textRange module and there is a problem. Then I'm using selection.expand('word') on the such text "расстояние {москва} геленджика" (selected text in brackets) Rangy expands it to the adjacent words and I got such selected texts "{расстояние москва геленджика}". But in this case I already have a selected word! I just need expanding to {москва} in м{оск}ва situations.
How can I solve this? What is the difference between different languages, that causing this problem?
I answered this on the Rangy forum. In case that link stops working, here's what I wrote:
It's set up for Latin script by default, but you can specify a regular expression in the expand() method. The default is /[a-z0-9]+('[a-z0-9]+)*/gi, which is pretty basic but provided as a reasonable default for English.
A simple example:
sel.expand("word", {
wordOptions: {
wordRegex: /[a-z0-9\u0400-\u04FF]+('[a-z0-9\u0400-\u04FF]+)*/gi
}
});
I'm no expert in Cyrillic so I've just added some Cyrillic characters to the character classes in the regular expression for illustration purposes. You could do better using XRegExp and its Unicode plugin:
sel.expand("word", {
wordOptions: {
wordRegex: XRegExp("[\\p{L}\\d]+('[\\p{L}\\d]+)*", "gi")
}
});

Related Links

AQGridView Selection and Deselection
make 2 different selection-tools coexist in pyside
Swapping text selections in Sublime Text 2
Selecting text with Sublime Text 2
Stata: Lag length criteria: How can I explain the results?
jquery-autocomplete default selection
Zend Studio selecting full Block
Genetic Algorithm - producing a new generation
UICollectionView shouldSelectItemAtIndexPath=NO does not avoid deselecting old selection?
UICollectionView Tap Selects More Than One Cell
Should this be selection or projection
Deselecting cells programmatically in NSMatrix does not work
Sublime Text 2 multiple selection at boundaries of selection (Mac OS X)
How should Stochastic Universal Sampling be combined with Elitism in Genetic Programming?
Sencha Chart 2.0 - Multiple Selection
Why Rangy library doesn't work with contenteditable in Opera?

Categories

HOME
office365
visual-studio
opencart
yaml
xcode8.1
paypal-ipn
key
plaid
google-play-services
web2py
mirc
amp
dji-sdk
fedora
eddystone
hystrix
sap-fiori
mailmerge
xbap
freertos
bundler
corona
heap-dump
rest-assured
pygobject
web-deployment
coroutine
codefluent
nullreferenceexception
pfobject
azure-machine-learning
conda
batch-rename
fluent-migrator
candlestick-chart
sipp
software-packaging
pubxml
math.js
copy-protection
opnet
fotorama
seafile-server
private-key
quickcheck
jfxtras
django-crispy-forms
rdp
best-buy-api
plane
raytracing
yoast
docker-ucp
wysihtml5
renderman
iptv
android-sharing
nslayoutconstraint
word-2007
deedle
portability
test-data
wikimapia
.when
oid
allegro
logical
decoder
visual-studio-monaco
jsf-2.3
carmen
callouts
unsigned
utf-16
as3-api
android-mapview
cfwheels
wso2ml
dynamics-ax-2012-r2
tree-structure
webproject
rfc5545
pass-by-value
famo.us
lifetime
string.format
dnsjava
flurry-analytics
nidaqmx
loginview
fileshare
zend-search-lucene
map
strdup
autonumber
jmenubar
sunstudio
dynamic-rdlc-generation
notin
spiral
cyrillic
jsplitpane
simplecov
wndproc
server-name
algol68
microblogging
groovy-console
downgrade
cassini
getimagesize
dm
jquery-effects
eai
index.dat
version-control-migration
html-generation
word-automation

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App