RE: [patch] Tabbing in listings

2008-09-26 Thread Vincent van Ravesteijn - TNW
> Just or information, I found btw. a crash bug in listings (independent >of your work I think): > http://bugzilla.lyx.org/show_bug.cgi?id=5287 > > regards Uwe I pass this one to JMarc. It has something to do with: http://www.lyx.org/trac/changeset/26428 Vincent

RE: [patch] Tabbing in listings

2008-09-26 Thread Vincent van Ravesteijn - TNW
> Just or information, I found btw. a crash bug in listings >(independent of your work I think): > http://bugzilla.lyx.org/show_bug.cgi?id=5287 > > regards Uwe I think I'll pass this to Jmarc, it has to do something with:

Re: [patch] Tabbing in listings

2008-09-26 Thread Uwe Stöhr
That it won't be lost: Attached is the complete patch against current trunk including the fileformat and lyx2lyx stuff. As José decided, this won't go in before rc3 is out. regards Uwe Index: development/FORMAT === --- development/F

Re: [patch] Tabbing in listings

2008-09-26 Thread Uwe Stöhr
Vincent van Ravesteijn - TNW schrieb: This can be set via de listings-option tabsize=4. The default tabsize defined in the listings package is 8. This means we should add tabsize=4 as a default option, but we have to make sure that the user can override this. It is probably the best to

RE: [patch] Tabbing in listings

2008-09-26 Thread Vincent van Ravesteijn - TNW
>> Lyx 1.6.0svn didn't support tabs either. It writes the tabs into the >> .lyx file, but only reading a .lyx file didn't work properly. I solved >> this by just adding two terms to Lexer.cpp (see below) > >I see here still a problem: >A TAB is by default 8 characters long in a textfile. But this

Re: [patch] Tabbing in listings

2008-09-26 Thread Uwe Stöhr
Vincent van Ravesteijn - TNW schrieb: Lyx 1.6.0svn didn't support tabs either. It writes the tabs into the .lyx file, but only reading a .lyx file didn't work properly. I solved this by just adding two terms to Lexer.cpp (see below) I see here still a problem: A TAB is by default 8 characters

Re: [patch] Tabbing in listings

2008-09-26 Thread Jürgen Spitzmüller
Uwe Stöhr wrote: > This is not really a fileformat change. When you revert a listing to LyX > 1.5, the TABs will be erased as LyX 1.5 doesn't support TABs. But what I > can do is to try to convert the TABs via lyx2lyx to 4 spaces. Should I do > this? Yes, if the output is sufficient. In any case,

Re: [patch] Tabbing in listings

2008-09-26 Thread José Matos
On Friday 26 September 2008 14:18:03 Vincent van Ravesteijn - TNW wrote: > Lyx 1.6.0svn didn't support tabs either. It writes the tabs into the > .lyx file, but only reading a .lyx file didn't work properly. I solved > this by just adding two terms to Lexer.cpp (see below) > > Isn't this the same f

RE: [patch] Tabbing in listings

2008-09-26 Thread Vincent van Ravesteijn - TNW
>>> Pavel Sanda wrote: >>> >>> i just tried this patch and seems to work correctly. > >Works fine for me too. Attached is the patch against current trunk. > >>> if there are no other comments, i'll put it in. >>> lfuns will be sorted later. >> >> I wonder if something needs to be done on reversio

Re: [patch] Tabbing in listings

2008-09-26 Thread Uwe Stöhr
>> Pavel Sanda wrote: >> >> i just tried this patch and seems to work correctly. Works fine for me too. Attached is the patch against current trunk. >> if there are no other comments, i'll put it in. >> lfuns will be sorted later. > > I wonder if something needs to be done on reversion to 1.5.x.

Re: [patch] Tabbing in listings

2008-09-25 Thread Juergen Spitzmueller
Pavel Sanda wrote: >> Et voila, .. (oh no, no more french on the list...) > > i just tried this patch and seems to work correctly. > if there are no other comments, i'll put it in. > lfuns will be sorted later. I wonder if something needs to be done on reversion to 1.5.x. IOW, is this a file for

Re: [patch] Tabbing in listings

2008-09-25 Thread Abdelrazak Younes
On 25/09/2008 15:16, Jean-Marc Lasgouttes wrote: Abdelrazak Younes<[EMAIL PROTECTED]> writes: AFAIR, the only reason that was given to me when I wanted to change pit_type to size_t is that we are not sure of out of bound issues that may appear in loops. I am quite confident nowadays that th

Re: [patch] Tabbing in listings

2008-09-25 Thread Jean-Marc Lasgouttes
Abdelrazak Younes <[EMAIL PROTECTED]> writes: > AFAIR, the only reason that was given to me when I wanted to change > pit_type to size_t is that we are not sure of out of bound issues that > may appear in loops. I am quite confident nowadays that there will be > no such issue. So fine with me if yo

Re: [patch] Tabbing in listings

2008-09-25 Thread Abdelrazak Younes
On 25/09/2008 15:04, Jean-Marc Lasgouttes wrote: Abdelrazak Younes<[EMAIL PROTECTED]> writes: That's historical: pit_type == pos_type == int > From what I remember, there was a reason for pos (we use -1 to get labelfont, or something), but not for pit, is it? AFAIR, the only r

Re: [patch] Tabbing in listings

2008-09-25 Thread Jean-Marc Lasgouttes
Abdelrazak Younes <[EMAIL PROTECTED]> writes: > That's historical: pit_type == pos_type == int >From what I remember, there was a reason for pos (we use -1 to get labelfont, or something), but not for pit, is it? JMarc

Re: [patch] Tabbing in listings

2008-09-25 Thread Abdelrazak Younes
On 25/09/2008 14:32, Jean-Marc Lasgouttes wrote: Abdelrazak Younes<[EMAIL PROTECTED]> writes: Make that a pit< int(paragraphs().size()). But this kind of assertion is not needed, this is already detected in debug mode by the stl. But why is pit an int? That's historical: pi

Re: [patch] Tabbing in listings

2008-09-25 Thread Jean-Marc Lasgouttes
Abdelrazak Younes <[EMAIL PROTECTED]> writes: > Make that a pit< int(paragraphs().size()). But this kind of assertion is not > needed, this is already detected in debug mode by the stl. But why is pit an int? JMarc

Re: [patch] Tabbing in listings

2008-09-25 Thread Abdelrazak Younes
On 25/09/2008 13:37, Pavel Sanda wrote: Vincent van Ravesteijn wrote: + LASSERT(pit< paragraphs().size(), /**/); + LASSERT( pit< paragraphs().size(), /**/ ); + LASSERT(cur.pit()>= 0&& cur.pit()< paragraphs

Re: [patch] Tabbing in listings

2008-09-25 Thread Pavel Sanda
Vincent van Ravesteijn wrote: > + LASSERT(pit < paragraphs().size(), /**/); > + LASSERT( pit < paragraphs().size(), /**/ ); > + LASSERT(cur.pit() >= 0 && cur.pit() < > paragraphs().size(), /**/); btw gcc gives warnings ab

Re: [patch] Tabbing in listings

2008-09-25 Thread Pavel Sanda
Vincent van Ravesteijn wrote: > Et voila, .. (oh no, no more french on the list...) i just tried this patch and seems to work correctly. if there are no other comments, i'll put it in. lfuns will be sorted later. pavel

Re: [patch] Tabbing in listings

2008-09-25 Thread Pavel Sanda
Vincent van Ravesteijn - TNW wrote: > No, it also works on a selection, then it eats a tab or spaces from the > beginning of each line spanned by the selection. This is extremely > useful if you want to indent/unindent multiple lines in one action. doxy, doxy, doxy ! :) pavel

RE: [patch] Tabbing in listings

2008-09-25 Thread Vincent van Ravesteijn - TNW
>> Shift-Tab aka. BackTab; it should be used in a Listing inset, when the >> cursor is right after a space or Tab or when there is a selection. > >so the only difference to the current backspace is that it also knows >to eat 4 spaces in one step, right? i'm not sure this is not > overdesigned, ju

Re: [patch] Tabbing in listings

2008-09-25 Thread Pavel Sanda
Abdelrazak Younes wrote: >>> + { LFUN_LISTINGS_TAB_INSERT, "listings-tab-insert", >>> SingleParUpdate, >>> Edit }, >>> >> >> maybe we can use LFUN_TAB_INSERT, so we can re-use it somewhere else when >> needed? >> > > What about LFUN_UNICODE_INSERT? (unicode-insert tab>). we

Re: [patch] Tabbing in listings

2008-09-25 Thread Pavel Sanda
Vincent van Ravesteijn - TNW wrote: > Shift-Tab aka. BackTab; it should be used in a Listing inset, when the > cursor is right after a space or Tab or when there is a selection. so the only difference to the current backspace is that it also knows to eat 4 spaces in one step, right? i'm not sure

Re: [patch] Tabbing in listings

2008-09-25 Thread Abdelrazak Younes
On 25/09/2008 00:53, Pavel Sanda wrote: Vincent van Ravesteijn wrote: - - + { LFUN_LISTINGS_TAB_INSERT, "listings-tab-insert", SingleParUpdate, Edit }, maybe we can use LFUN_TAB_INSERT, so we can re-use it somewhere else when needed? What about LFUN_UNICODE_INSE

RE: [patch] Tabbing in listings

2008-09-24 Thread Vincent van Ravesteijn - TNW
>> - >> - >> +{ LFUN_LISTINGS_TAB_INSERT, "listings-tab-insert", SingleParUpdate, >> +Edit }, > >maybe we can use LFUN_TAB_INSERT, so we can re-use it somewhere else when needed? > Is possible.. >> +/*! >> + * \var lyx::FuncCode lyx::LFUN_LISTINGS_TAB_DELETE >> + * \li Action: Delete

Re: [patch] Tabbing in listings

2008-09-24 Thread Pavel Sanda
Vincent van Ravesteijn wrote: > - > - > + { LFUN_LISTINGS_TAB_INSERT, "listings-tab-insert", > SingleParUpdate, Edit }, maybe we can use LFUN_TAB_INSERT, so we can re-use it somewhere else when needed? > +/*! > + * \var lyx::FuncCode lyx::LFUN_LISTINGS_TAB_DELETE > + * \li Action: D

Re: [patch] Tabbing in listings

2008-09-24 Thread Vincent van Ravesteijn
Vincent van Ravesteijn wrote: Vincent van Ravesteijn wrote: > > PS. I still used the 'old' LFUNs, I didn't want to stir the patch too > much.. so small steps at a time (changing the LFUNs is not a large > change to this patch). > An attempt to add two LFUNs for tabbing is Listings. If you like t

Re: [patch] Tabbing in listings

2008-09-24 Thread Vincent van Ravesteijn
Vincent van Ravesteijn wrote: PS. I still used the 'old' LFUNs, I didn't want to stir the patch too much.. so small steps at a time (changing the LFUNs is not a large change to this patch). An attempt to add two LFUNs for tabbing is Listings. If you like the names (I'm never that good in think

Re: [patch] Tabbing in listings

2008-09-24 Thread Vincent van Ravesteijn
Pavel Sanda wrote: Vincent van Ravesteijn - TNW wrote: > Here it is. It allows : > -inserting tabs, > -removing tabs and spacing by backtab, > -copying code with tabs from other applications. Vincent, have you worked on this lately? if we want to have it in before rc3, the time is

Re: [patch] Tabbing in listings

2008-09-24 Thread Vincent van Ravesteijn
Pavel Sanda wrote: Vincent van Ravesteijn - TNW wrote: > Here it is. It allows : > -inserting tabs, > -removing tabs and spacing by backtab, > -copying code with tabs from other applications. Vincent, have you worked on this lately? if we want to have it in before rc3, the time is

Re: [patch] Tabbing in listings

2008-09-24 Thread Pavel Sanda
Vincent van Ravesteijn - TNW wrote: > Here it is. It allows : > -inserting tabs, > -removing tabs and spacing by backtab, > -copying code with tabs from other applications. Vincent, have you worked on this lately? if we want to have it in before rc3, the time is short :) pavel

Re: [patch] Tabbing in listings

2008-09-08 Thread Bo Peng
> I think it is about how LyX displays the tabs. Now, the tabs are painted by > QPainter and the cursor movement is guided by QFontMetrics. I tried to paint > the tabs and to guide the cursor myself, but this lead to (for me) > ununderstandable crashes. If you know how we can override the defaul

RE: [patch] Tabbing in listings

2008-09-08 Thread Vincent van Ravesteijn - TNW
>> The TAB width should be consistent for all listings in a document. You >> are right, that some prefer 3 characters, some 4, some only 2. So what >> we need is an item in the listings dialog in the document settings. 4 >> should be the default. >> The current 8 characters width is definitively

Re: [patch] Tabbing in listings

2008-09-07 Thread Bo Peng
> The TAB width should be consistent for all listings in a document. You are > right, that some prefer 3 characters, some 4, some only 2. So what we need > is an item in the listings dialog in the document settings. 4 should be the > default. > The current 8 characters width is definitively too wid

Re: [patch] Tabbing in listings

2008-09-07 Thread Uwe Stöhr
Vincent van Ravesteijn - TNW schrieb: Pasting C++ Code to a listings inset doesn't work: Actually, it does work. Did you try Edit->Paste Special->Plain Text (or Ctrl-Shift-V). It looks like that Paste is binded to "Paste, Join Lines" or something like that. Yes my fault, I used Ctrl-v not Ct

RE: [patch] Tabbing in listings

2008-09-07 Thread Vincent van Ravesteijn - TNW
>> Pasting C++ Code to a listings inset doesn't work: Actually, it does work. Did you try Edit->Paste Special->Plain Text (or Ctrl-Shift-V). It looks like that Paste is binded to "Paste, Join Lines" or something like that. > Looks sensible. The size of a TAB is the width of 8 typewriter > chara

Re: [patch] Tabbing in listings

2008-09-07 Thread Uwe Stöhr
Vincent van Ravesteijn - TNW schrieb: Here it is. It allows : -inserting tabs, -removing tabs and spacing by backtab, -copying code with tabs from other applications. Pasting C++ Code to a listings inset doesn't work: Try to copy this code ~Impl() {

Re: [patch] Tabbing in listings

2008-09-07 Thread Pavel Sanda
Vincent van Ravesteijn - TNW wrote: > src/frontends/qt4/GuiFontMetrics.cpp : > >The line "metrics_.width(ucs4_to_qchar(c))" wasn't working properly for > tabs >(returned the size of a single space instead of 8). That's why {&& c != > '\t'} is >necessary in the following: i would

[patch] Tabbing in listings

2008-09-07 Thread Vincent van Ravesteijn - TNW
Uwe stoehr wrote: >> What I still miss in our listings support is this: >> http://bugzilla.lyx.org/show_bug.cgi?id=3629 >> >> > > When you have the patch ready, I'll test it. > Here it is. It al