[QScintilla] Tab-Width

Phil Thompson phil at riverbankcomputing.com
Sat Nov 17 12:00:50 GMT 2007


On Thursday 15 November 2007, Nicholas Sloan wrote:
> Phil Thompson wrote:
> > On Wednesday 14 November 2007, Nicholas Sloan wrote:
> >> Alright, I'll probably be posting more often now, since I'm at a point
> >> in my project where a lot of my focus is going to be on the editor
> >> component.
> >>
> >> I am calling QsciScintilla::setTabWidth(2); in the constructor of a
> >> class that inherits QsciScintilla. I have used QsciScintilla::setFont();
> >> to set a monotype font. setTabWidth() is changing the tab-width, as
> >> expected, however, a value of 2 yields the width of approximately 1
> >> character. A value of 3 yields 1 and 1/2 characters, and a value of four
> >> actually yields the desired 2 characters. It appears that 1 "character"
> >> as set by setTabWidth() is about half the width of an actual character.
> >>
> >> Is this behavior desired or expected for some reason? I can't seem to
> >> find any rationale for it.
> >
> > Are you setting a lexer? A small example would help.
> >
> > Phil
> > _______________________________________________
> > QScintilla mailing list
> > QScintilla at riverbankcomputing.com
> > http://www.riverbankcomputing.com/mailman/listinfo/qscintilla
>
> Phil,
>
> Here is the relevant code:
>
> //This will yield a tab that is as wide as 2 characters.
>
> MyQsciScintilla::MyQsciScintilla()
> {
>     QsciScintilla();
>     this->setMarginLineNumbers(1,true);
>     QFont monospaced("Monospace",10);
>     this->setFont(monospaced);
>     this->setTabWidth(4);
> }
>
> //This will yield a tab that is as wide as 1 character.
>
> MyQsciScintilla::MyQsciScintilla()
> {
>     QsciScintilla();
>     this->setMarginLineNumbers(1,true);
>     QFont monospaced("Monospace",10);
>     this->setFont(monospaced);
>     this->setTabWidth(2);
> }
>
> Thanks for the help.

What version are you running? I think this is already fixed in the current 
snapshot.

Phil


More information about the QScintilla mailing list