[texworks] Select/Paste not working

Jonathan Kew jfkthame at googlemail.com
Sun Jun 7 15:59:14 CEST 2009


On 7 Jun 2009, at 14:42, Stefan Löffler wrote:

> Hi,
>
> On 2009-06-07 14:11, Jonathan Kew wrote:
>> This may be related to how TeXworks overrides some mouse-click
>> behaviors (primarily because the default selection behavior in Qt's
>> text edit isn't suitable for TeX editing).
>
> Not sure if that's it, but could be. In any case what I think we  
> should
> be looking at is QClipboard::setText with  
> mode=QClipboard::Selection. I
> assumed that this should be done automatically by the signal
> QClipboard::selectionChanged (what else could that be there for?), but
> if it isn't, setText seems to be the place to start. I just didn't  
> have
> time to look into it much yet (see my other message).

I've been looking at this a bit, and I think all that's needed is to  
add something like

     QApplication::clipboard()->setText(
         curs.selectedText().replace(QChar(0x2019), QChar('\n')),
         QClipboard::Selection);

at a few places in CompletingEdit where it sets the selection (during  
mouse event handling). I guess normally QTextEdit would do this  
internally, but in some cases the TeXworks subclass overrides the  
QTextEdit handling and ends up setting the selection itself.

I expect I'll commit a fix for this soon...

JK



More information about the texworks mailing list