Georg Baum wrote: > > > > for point 2 i got just single > > GuiApplication.cpp(1446): X requested selection. > > BufferView.cpp(1491): requestSelection: xsel_cache.set: 1 > > > > > > two questions : > > 1. i dont understand why we get those milions X requests only in case > > we run two instances. > > this point could also explain some hard to catch bugs with slow > > performance because this X request appear only in this way. ....
> Your observations could be explained with excessive selection polling by the > second LyX instance. The reason could be that the second LyX instance > detects LyX contents in the first LyX instance that it wants to syncronize. > If this is true it is probably caused by the persistent selection feature, > and it is a bug, because it is worse than using the stupid qt selection > model. I don't know how the selection is currently supposed to work in LyX. > When I implemented the original support of formatted selection/clipboard > between different LyX instances I used only one selection request in the > scenario you described. fyi i found this: 1 instance of lyx - no X requested selection when selecting text (for example via shift + pressinf arrow key press) 2 instances - usually 3x X requested selection (in the instance where you are selecting) 3 instances - usually 7x X requested selection 4 instances - usually 11x X requested selection 5 instances - usually 15x X requested selection > > 2. i don't clearly understand the purpose BufferView::xsel_cache and > > there is no commentary in the code. i have just found we use some dirty > > tricks with selection for performance reasons, but still don't > > understand the whole machinery. but its clear that the working case > > have xsel_cache.set bit == 0. > > IIRC xsel_cache is used to get the cursor slices of the selection when > another application requests the selection. I am not sure whether such a > cache is really needed, I believe that it is only useful if you want to get > the selection after it was already deselected. on many cases once the selection is deselected i can't put it outside lyx application anymore (1 instance now). what makes me perplexed is quasi randomness of this behaviour. usually working recipe is: launch lyx, new document, type "ffff", shift +left arrow (to select), click somewhre to deselect, try to paste in some terminal -> nothing (recipe 1). however when i skip the deselection phase and paste in some terminal (recipe 2), it works. and finally recipe 3: do recipe 2, deselect as in recipe 1 and the second paste start working ! as if pasting somewhere else set some (other) cache, but i do not see where. looking at the code, the role of xsel_cache is mystery to me, since the code seems to be intended as "when xsel_cache is NOT set, then return selection" (BufferView::requestSelection). blame of the key parts around src/BufferView.cpp:1423 points to you, Abdel, please can you give me some more comment before i break something by changing how xsel_cache works (is inteneded to work)? pavel