[QScintilla] wrong cursor moving

Phil Thompson phil at riverbankcomputing.com
Thu Nov 4 17:24:16 GMT 2010


On Thu, 04 Nov 2010 18:15:29 +0100, "petr at scribus.info"
<petr at scribus.info>
wrote:
> hi all,
> I'd like to open this issue again. It looks like the editor is quite
> unusable on mac. So I'd like to perform some investigations for proper
> bugreport...
> 
> On Tue, 29 Jun 2010 15:00:45 +0100, Phil Thompson
> <phil at riverbankcomputing.com> wrote:
>> On Wed, 16 Jun 2010 07:18:25 +0200, Petr Vanek <petr at scribus.info>
wrote:
>>> hi all,
>>>
>>> it looks there is a bug in cursor position calculation. When I set
>>> qscintilla to use non-monospaced font (timing was screwed by youtube,
>>> so the video is fast):
>>>
>>> http://www.youtube.com/watch?v=8KiqDbAf4pc
>>>
>>> It looks like the cursor is moved like with monospaced fonts - the gap
>>> between real position and position where it should be is growing with
>>> longer texts.
>> 
>> I've had other similar reports, but only with the Cocoa version of Qt -
>> the
>> Carbon version is fine, which suggests it is a Qt problem.
> 
> It's strange that the wrong sizing is not happening in the standard Qt
> edit widgets.
> 
> Can you somebody run this code on Linux/Windows, please?
> 
> #include <QtGui>
> #include <QtDebug>
> 
> int main(int argc, char *argv[])
> {
>     QApplication a(argc, argv);
>     QFont ff("Courier New");
>     QFont vf("Arial");
> 
>     qDebug() << vf << ff;
> 
>     QFontMetrics vfi(vf);
>     QFontMetrics ffi(ff);
> 
>     qDebug() << "variable" << vfi.width("m") << vfi.width("i") <<
> ffi.width("mi") << vfi.width("mimi");
>     qDebug() << "   fixed" << ffi.width("m") << ffi.width("i") <<
> ffi.width("mi") << ffi.width("mimi") << ffi.width("mimimimi");
> 
>     return 0;
> }
> 
> my results are:
> QFont( "Arial,12,-1,5,50,0,0,0,0,0" ) QFont( "Courier
> New,12,-1,5,50,0,0,0,0,0" ) 
> variable 10 3 14 25 
>    fixed  7 7 14 29 58
> 
> which can point on that the fixed-with fonts are calculated wrongly
> (just guessing). I would expect
> 7 7 14 28 56
> 
> but it's only the try...

QFont( "Arial,12,-1,5,50,0,0,0,0,0" ) QFont( "Courier
New,12,-1,5,50,0,0,0,0,0" ) 
variable 13 4 20 34 
   fixed 10 10 20 40 80

Phil


More information about the QScintilla mailing list