Page 3 of 11 FirstFirst 12345 ... LastLast
Results 41 to 60 of 216

Thread: QCodeEdit

  1. #41
    Join Date
    Feb 2007
    Posts
    34
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Lightbulb Re: QCodeEdit

    Hi,

    It would be nice while you are working on such a handy widget is to add a much needed feature which hasn't been done for the last 10 years or so.

    It would be nice if you added the ability to do column based selections with copy/cut and paste like Brief (long long time ago) or CRiSP or SlickEdit (more contemporary).

    Thanks!

  2. #42
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by Usability View Post
    And another thing...
    Does it work on your machine with a variable width font? Here, unless I go for the default fixed with font, selecting part of a line causes corruption of the text. For example, choose a proportional font, and select a the word in the middle of a line and let me know if the line is still readable for you.
    Support for variable width font has at last been brought (available in the SVN...)

    Quote Originally Posted by Usability
    The language I am creating is not case sensitive, i.e. Begin, BEGIN, begin, bEGIN etc are all keywords, indeed all the same keyword.
    Is there some tag I can insert into a .qnfa file to instruct it do case insensitive comparisons?
    Done. A new attribute has been added : caseSensitive. It is supported by all tags (except, obviously, by the <embed> one). All element that do not set it inherit the value of their parent and the default value of the root element is "true".BTW, as all boolean attributes it can be set indifferently using "true", "false", "enabled", "disabled", "0" or "1"

    Quote Originally Posted by croftj
    It would be nice if you added the ability to do column based selections with copy/cut and paste like Brief (long long time ago) or CRiSP or SlickEdit (more contemporary).
    I'm thinking about it. I admit it would be extremely nice to have but it's not that easy to implement...
    Current Qt projects : QCodeEdit, RotiDeCode

  3. #43
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Cool!

    I confirm I see proportional fonts and the case sensitivity flag works. To save others working back through this thread and dealing with the abbreviated links, here is the svn command to get this.

    Qt Code:
    1. svn checkout http://edyuk.svn.sourceforge.net/svnroot/edyuk/trunk/3rdparty/qcodeedit
    To copy to clipboard, switch view to plain text mode 

    There appear to be a few glitches.

    • On my system, when I use a proportional font, find doesn't work.
    • Also with proportional fonts, the text that is made bold by the syntax highlighting does not increase in character spacing, so gets squashed together.
    • With a fixed width font the find backwards icon (up arrow) behaves strangely. The first reverse find sometimes updates the line number in the status bar, but does not move the cursor at all. Other times it just does nothing.

  4. #44
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by Usability View Post
    • On my system, when I use a proportional font, find doesn't work.
    Well... Quite unsurprisingly it does work for me whatever the font is. However it sometimes isn't triggered when pressing enter from the line edit... That's weird and I'll look into it ASAP

    Quote Originally Posted by Usability View Post
    • Also with proportional fonts, the text that is made bold by the syntax highlighting does not increase in character spacing, so gets squashed together.
    The bold text looked normal to me at first but you're right, spacing could be a little bigger and I'll solve this easily for I know why it happens

    Quote Originally Posted by Usability View Post
    • With a fixed width font the find backwards icon (up arrow) behaves strangely. The first reverse find sometimes updates the line number in the status bar, but does not move the cursor at all. Other times it just does nothing.
    The find backward is known not to work... However I didn't have time to fix it lately. I'll try my best...
    Current Qt projects : QCodeEdit, RotiDeCode

  5. #45
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by fullmetalcoder View Post
    Well... Quite unsurprisingly it does work for me whatever the font is. However it sometimes isn't triggered when pressing enter from the line edit... That's weird and I'll look into it ASAP
    Your right, the font has nothing to do with it. Find stops working for a while if you search for something thats not in the file, or you repeat the find after the last occurance. Having done this, neither the enter or find forward button work even if you change the search for something that does exist.

    Clicking the reverse find brings it back to life again.

  6. #46
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by Usability View Post
    Your right, the font has nothing to do with it. Find stops working for a while if you search for something thats not in the file, or you repeat the find after the last occurance. Having done this, neither the enter or find forward button work even if you change the search for something that does exist.

    Clicking the reverse find brings it back to life again.
    Find now works as expected:
    • it no longer tries a backward search when asked for a forward one
    • it is now able to perform proper backward searches
    • it now respects boundaries (i.e search within selection)
    • focus is now sent back to the line edit every time a checkbox of the search panel is (un)checked so that pressing enter afterwards triggers search as expected


    BTW I tried to increase spacing for bold fonts by using a proper QFontMetrics object operating on a bold font (instead of the default document font) but it didn't appeared to change much... however as bold characters didn't get squashed on my box it might solve the glitches on yours...
    Current Qt projects : QCodeEdit, RotiDeCode

  7. #47
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Getting better all the time!
    I confirm find in both directions works now, and that syntax highlighting in bold on proportional fonts is nicely spaced.

    One gremlin I did notice was that if you select some bold text, the background shading breaks up. Its OK if you select a complete line, or if the text isn't bold, its specifically the word selection of bold text that is not working quite right. I attached a snapshot of this below.

    Also I noticed my previous svn command was wrong. Here is the (hopefully) correct version

    Qt Code:
    1. svn checkout http://edyuk.svn.sourceforge.net/svnroot/edyuk/trunk/3rdparty/qcodeedit2
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images

  8. #48
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by Usability View Post
    One gremlin I did notice was that if you select some bold text, the background shading breaks up. Its OK if you select a complete line, or if the text isn't bold, its specifically the word selection of bold text that is not working quite right. I attached a snapshot of this below.
    Side effect of the previous fix... Looks like QFontMetrics behaves differently on Linux and Windows BTW for I did not notice this (could also be my variable width font being more "bold-friendly" ...). Anyway I just fixed it (or so I believe, but I need a confirmation...)
    Current Qt projects : QCodeEdit, RotiDeCode

  9. #49
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by fullmetalcoder View Post
    Side effect of the previous fix... Looks like QFontMetrics behaves differently on Linux and Windows BTW for I did not notice this (could also be my variable width font being more "bold-friendly" ...). Anyway I just fixed it (or so I believe, but I need a confirmation...)
    Indeed you fixed it, and stunningly quickly too! Thank you.

    You are going to hate me for this, but I found one more....
    When you click on a line that has some bold words to the left of where the mouse cursor was when you clicked, the text cursor is not placed under the mouse cursor. It appears a few characters to the right of where the mouse was.

    If you click on a line with no bold, it works fine. The text cursor is inserted where the mouse cursor was.

  10. #50
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by Usability View Post
    You are going to hate me for this, but I found one more....
    When you click on a line that has some bold words to the left of where the mouse cursor was when you clicked, the text cursor is not placed under the mouse cursor. It appears a few characters to the right of where the mouse was.

    If you click on a line with no bold, it works fine. The text cursor is inserted where the mouse cursor was.
    Come on! Why would I hate such a helpful tester? If I claim to support variable width fonts I'd better do it properly... Proper fix should be on SVN already by the time you read this message.
    Current Qt projects : QCodeEdit, RotiDeCode

  11. #51
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    That fixed it, thanks!

    A very nice editor you have there.

  12. #52
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    I just found a folding bug.

    Invoke the example shipped with the editor thus:
    example/example
    In the text that appears, enter an open brace, ie {
    The folding markers appear, but there is no end to the fold due to the bracket imbalance.
    Click on the - to close the fold, and the editor will crash.

  13. #53
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by Usability View Post
    I just found a folding bug.
    I just fixed it Thank you for your accurate reports.
    Current Qt projects : QCodeEdit, RotiDeCode

  14. #54
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Indeed you did, and stunningly quickly too!
    Thank you

  15. #55
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by croftj View Post
    It would be nice if you added the ability to do column based selections with copy/cut and paste like Brief (long long time ago) or CRiSP or SlickEdit (more contemporary).
    I just added column column-based edit which opens way for selection but I'll need advice on this to ensure that they will not alter the overall usability of the editor...

    By the way I did a lot more than column based edit (though it also allows it) : I added something I called "cursor mirrors". These are cursors which mimic the actions of the "real" cursor. You can place them anywhere by holding the Control key while clicking and start typing.

    There are some limitations and probably some polishing left to do but it works quite fine and open new perspectives for tedious and repetitive tasks...
    Current Qt projects : QCodeEdit, RotiDeCode

  16. #56
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by fullmetalcoder View Post
    I added something I called "cursor mirrors". These are cursors which mimic the actions of the "real" cursor. You can place them anywhere by holding the Control key while clicking and start typing.
    Wild! I have never seen anything like that before. It seems likely it will be useful, but only time will tell.

    Is the column editing available yet, or just work in progress? I couldn't find any way to select a column yet.

    My preference for a user interface is the nedit approach of click then control click to specify the corners of the column, or a control drag to specify its area. The kwrite/kate approach of shift-ctrl-b to toggle between rectangular and normal selection modes always seemed clunky by comparison. But going down the ctrl drag route would mean finding another way to drop your cursor mirrors. Ctrl+alt for the mirrors perhaps.

    Incidentally, I did spot a minor bug yesterday while introducing code folding markers into one of our languages. You can reproduce it with the cpp.qnfa file. Try this change
    Qt Code:
    1. line 38 before
    2. <sequence parenthesis="curly:close" indent="1" fold="1">}</sequence>
    3. after
    4. <sequence parenthesis="curly:close" indent="1" fold="1"> </sequence>
    To copy to clipboard, switch view to plain text mode 
    Note the close marker is changed from a } to a space. The editor will now segfault on invocation. Sure its a stupid thing do to, and was in fact a mistake, but crashing seemed a bit harsh.

  17. #57
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by Usability View Post
    Is the column editing available yet, or just work in progress? I couldn't find any way to select a column yet.
    Column editing, as far as I understood, is just a restriction of cursor mirrors. I added a way to do it directly : Ctrl + drag the cursor vertically and it will automatically add cursor mirrors all along.

    Quote Originally Posted by Usability View Post
    My preference for a user interface is the nedit approach of click then control click to specify the corners of the column, or a control drag to specify its area. The kwrite/kate approach of shift-ctrl-b to toggle between rectangular and normal selection modes always seemed clunky by comparison. But going down the ctrl drag route would mean finding another way to drop your cursor mirrors. Ctrl+alt for the mirrors perhaps.
    I was thinking about keeping the "regular" cursor mirrors as they are now and using ctrl+shift + mouse cursor drag to perform column selection... Can you test the current implementation and tell me what you think?

    Quote Originally Posted by Usability View Post
    Incidentally, I did spot a minor bug yesterday while introducing code folding markers into one of our languages. You can reproduce it with the cpp.qnfa file. Try this change
    Qt Code:
    1. line 38 before
    2. <sequence parenthesis="curly:close" indent="1" fold="1">}</sequence>
    3. after
    4. <sequence parenthesis="curly:close" indent="1" fold="1"> </sequence>
    To copy to clipboard, switch view to plain text mode 
    Note the close marker is changed from a } to a space. The editor will now segfault on invocation. Sure its a stupid thing do to, and was in fact a mistake, but crashing seemed a bit harsh.
    There indeed was a caveat in the xml to nfa converter... It made the assumption that all elements add a text child node... thanks for the report, I've just fixed this.
    Current Qt projects : QCodeEdit, RotiDeCode

  18. #58
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by fullmetalcoder View Post
    Column editing, as far as I understood, is just a restriction of cursor mirrors. I added a way to do it directly : Ctrl + drag the cursor vertically and it will automatically add cursor mirrors all along.
    I have never seen anything like this before, and I think its unique. You might start a trend with this.

    However I think the feature requested by croftj is the ability to cut and paste rectangles of text. Most editors have this, just run up kate, kwrite, or nedit and try it. Its ctrl-drag in nedit and ctrl-shift-b then a normal drag in kate/kwrite.

    You can cut a rectangle of text and paste it in somewhere else. The cursor mirrors do not help with this.

    I was thinking about keeping the "regular" cursor mirrors as they are now and using ctrl+shift + mouse cursor drag to perform column selection... Can you test the current implementation and tell me what you think?
    I think both cursor mirrors and column selections have their own uses, and keeping both would be good.

    For example if you want to change several lines of "filename.h" to <filename.h>, it would be perfect. However suppose you wanted to pick up characters 4 to 10 of every line, cut them out, and paste them all back in again at column 15. Its simple with a rectangular selection, but I can see no way of doing this with the current qcodeedit. ctrl+shift+drag does the same as a normal drag as far as I can tell, and the cursor mirrors do not appear to help for this.

    I think if you add rectangular cut/paste, you would need only one more feature to have an editor that could hold its own with the usual kate/kwrite/nedit crowd. I could get tempted to contribute a simple tabbed GUI for it and use it as a stand alone editor, if as I suspect, qcodeedit2 is faster. Being independent of KDE would be a useful advantage also.

    After rectanguar cut/paste the only other important omission would be commenting in/out a block of text. You could convert to comment by prepending what ever the language template identified with context id="comment/single", and convert from comment by removing that.

    This is important for languages like VHDL and TCL that only have the type of comment character stops at the end of the line.

  19. #59
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by Usability View Post
    I have never seen anything like this before, and I think its unique. You might start a trend with this.
    Time will tell... In case you care about history this feature had been requested already back in the times of DevQt genesis...

    Quote Originally Posted by Usability View Post
    However I think the feature requested by croftj is the ability to cut and paste rectangles of text. Most editors have this, just run up kate, kwrite, or nedit and try it. Its ctrl-drag in nedit and ctrl-shift-b then a normal drag in kate/kwrite.

    You can cut a rectangle of text and paste it in somewhere else. The cursor mirrors do not help with this.
    It DOES... It may not look obvious to the user but I use the exact same internal infrastructure to and rectangular selection, and it's already working... The CTRL+drag gives you a column edit right? Now do CTRL+SHIFT + drag (and move to right/left) and you'll obtain a rectangular selection that can be copied/cut/pasted. The paste mode is inspired from Kate/Kwrite : the MIME data is given a "text/column-selection" data which can be inserted on several lines (even if there is already some text...) and, as a fallback, the subsequent selections separated by linefeeds.


    Quote Originally Posted by Usability View Post
    ctrl+shift+drag does the same as a normal drag as far as I can tell, and the cursor mirrors do not appear to help for this.
    I knew I forgot something... D'n'D does not work yet with rectangular selection...

    Quote Originally Posted by Usability View Post
    I could get tempted to contribute a simple tabbed GUI for it and use it as a stand alone editor
    There is already such a GUI : Edyuk trimmed of all its plugins

    Quote Originally Posted by Usability View Post
    After rectanguar cut/paste the only other important omission would be commenting in/out a block of text. You could convert to comment by prepending what ever the language template identified with context id="comment/single", and convert from comment by removing that.
    I'll try to add that ASAP.
    Current Qt projects : QCodeEdit, RotiDeCode

  20. #60
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by fullmetalcoder View Post
    The CTRL+drag gives you a column edit right?
    It gives me a trail of cursor mirrors. Is that the same thing?

    Quote Originally Posted by fullmetalcoder View Post
    Now do CTRL+SHIFT + drag (and move to right/left) and you'll obtain a rectangular selection that can be copied/cut/pasted.
    It doesn't for me. I get a regular selection. It gives you the complete lines that were diagonally dragged over.

    Quote Originally Posted by fullmetalcoder View Post
    The paste mode is inspired from Kate/Kwrite : the MIME data is given a "text/column-selection" data which can be inserted on several lines (even if there is already some text...) and, as a fallback, the subsequent selections separated by linefeeds.
    That sounds perfect, its just I don't see it with the current svn checkout.
    I tried using
    example/example lib/qcodeedit.cpp

    I do not get anything special happening holding down shift and control while clicking and then dragging diagonally. Just a regular complete line selection occurs.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.