I think I just found a couple of bugs.
When using proportional fonts, the horizontal scroll bar appears to significantly under estimate the width of the text and will not allow scrolling to the end of the lines.
Also try this. Move the cursor to the start of a line either by clicking it there or using home. Now hold shift and press down cursor. In every other editor, this moves the cursor down to the start of the next line and selects all of the line that it left. In QCodeEdit it does this but also selects all of the line it moved to, leaving 2 lines completely selected.
It works now, thanks for that fix![]()
I just suffered using windows again long enough to check this still compiles on MSVC6. There were just two changes needed.
qeditor.cpp line 1120, do not return a value, its a void function.
Similarly 1685.
Hi Fullmetalcoder, I am having trouble refreshing the content of the editor. I did this
Qt Code:
pEditor->load(qsFileName);To copy to clipboard, switch view to plain text mode
and it causes a crash.
The call stack shows
- QEditor::load,
- QEditor::setText,
- QDocument::setText,
- qDeleteAll,
- qDeleteAll,
- QDocumentLineHandle::~QDocumentLineHandle,
- QDocumentPrivate::emitLineDeleted,
- QHash<Key, T>::remove,
- QHash<Key, T>::detach,
- QHash<Key, T>::detach_helper
If I am going about this the right way, hopefully you can bind some event in one of your programs to these two lines and reproduce the crash. If it doesn't just fall out and you need a test case, let me know.
Some search related questions.
I think there is a problem with the "In selection" option on find. A concrete example. I invoke the editor like this:
example/example lib/qcodeedit.cpp
Then select lines 35 to 39
key ctrl-f
enter new as the search string, and it finds the one on line 28. Note that this is with From cursor off.
What is the second button from the left in the find bar for? I have never know it do anything and it has no tool tip.
Is there any way I can set the "From cursor" option to be the default when I create an editor? I think this is what most people would expect of a find, and I want to save them the trouble of figuring out why their first find didn't do what they wanted.
I am having trouble writing the syntax file for a language that uses begin/end as the block start/end delimiters, like { and } in C.
I started with this:
Qt Code:
<sequence format="keyword" parenthesis="be_block:open" indent="1" fold="1">begin</sequence> <sequence format="keyword" parenthesis="be_block:close" indent="1" fold="1">end</sequence>To copy to clipboard, switch view to plain text mode
And the folding mostly worked well. Unfortunately it spotted the begin in
int beginning;
and marked it as the start of a fold-able block.
So I tried this:
Qt Code:
<list id="keywords/blocks" format="keyword"> <word parenthesis="be_block:close" indent="1" fold="1">begin</word> <word parenthesis="be_block:close" indent="1" fold="1">end</word> </list>To copy to clipboard, switch view to plain text mode
But that doesn't fold at all. Any suggestions on the solution for this?
A couple of related but somewhat pedantic questions. There seem to be some gremlins exposed by having begin and end markers on the same line. Try running the example editor, eg
example/example
And enter this:
Qt Code:
if (1) {;} else { } if { }To copy to clipboard, switch view to plain text mode
then collapse the fold starting on the if. For me this produces a corrupt screen showing three if lines. I appreciate that is an ugly example, and I wont be at all surprised if you choose to ignore it.
This one is a more reasonable code style.
Here if you fold up the if statement it folds the complete program. I am not sure this is correct. I was expecting the else branch to remain expanded.
This should work AFAIK :
Qt Code:
<word format="keyword" parenthesis="be_block:open" indent="1" fold="1">begin</word> <word format="keyword" parenthesis="be_block:close" indent="1" fold="1">end</word>To copy to clipboard, switch view to plain text mode
I'll look into it. I can't ignore such a bug if I want the syntax engine to trully be generic...
This is correct... As I can place more than one collapse/fold marker per line I decided to fold "whole" blocks... I can try to change that behavior (and possibly make it configurable) but I'm not sure it would be worth the effort. (correct me if I'm wrong).
Current Qt projects : QCodeEdit, RotiDeCode
I've corrected all the reported issues so far (or so I believe...)and taken the opportunity to improve the example app a bit.
I'm waiting for your feedback![]()
Last edited by fullmetalcoder; 24th November 2007 at 21:49.
Current Qt projects : QCodeEdit, RotiDeCode
Hi Fullmetalcoder.
I gave a program containing this editor to a college for comments, and got this feedback.
I'm really getting used to using this editor and growing more fond of it as the days go by, but there are a couple of minor suggestions/irritations:
1) When scrolling up when the cursor moves up from the top line of the screen it causes an extra line to appear - when scrolling down and the cursor hits the bottom of the screen the next down causes the next page to appear and the cursor is now at the top of this screen. This is extremely irritating!
2) When using find - what does the green button to the left of the string entry box do? When I click it it appears to do nothing.
3) There is a tooltip on the close button for the find toolbar, but not on the "green" button or the find forward/reverse buttons
4) When using the find forward button and then use the find reverse the first hit does not move onto the next match (the line number stays the same, but the column numbers change). The same is true when doing the reverse.
5) If you do a forward find and then move the cursor to a line above the found string, then hit find forward again it goes to the next match (I would expect that because the line with the cursor is highlighted that the previous match would be highlighted again)
Just noticed, prompted find/replace is broken. For example,
example/example lib/qcodeedit.cpp
Key ctrl-r, try and replace this with that. The settings I had were, match case, prompt on replace, from cursor.
I get a box asking "Shall it be replaced?" Clicking yes has no effect (other than to close the QMessageBox).
Neat!
- I'm not sure I understand this... Could you provide me with a screencast or a precise key sequence leading to this bug
- It is supposed to "refresh" the search context (see the QDocumentSearch class) but I guess I could remove it and use a couple signals/slots to make sure it (the search context remains up to date)
- There should be a tooltip on *all* buttons since the last commit
- I'm aware of that and I'll work on a proper fix ASAP
- This is a case where the "green button" should prove useful (but a proper signal/slot connection would probably be better...
)
- About the wrong replacement behavior it will be pretty easy to fix (qdocumentsearch.cpp there is only one call to QMessageBox)
- I'll try to reproduce this (and fix it hopefully) ASAP
Current Qt projects : QCodeEdit, RotiDeCode
Hi,
I got problems with variable width fonts - especially "Times New Roman" (I know you dont like Windows (and probably Windows Fonts), so do I, but it would be nice to be portable as much as possible).
Bug: When I set font to Times New Roman, black vertical lines are appearing between lines.
(Using svn 379)
Last edited by allstar; 28th November 2007 at 18:45.
.. lets hijack this thread to announce a pet project of mine...
I have been working outside of QDevelop to develop another code editor control. It's not as sofisticated as the one beeing discussed here, but it has it's own ideas and strong points. If you still want to see, please visit: http://code.google.com/p/qtedit4/wiki/QsvEditorBeta
Unfortunately I can't test under windows so it's hard for me to find proper fixes for such graphical glitches... May you send me the font file so that I can at least try with the most problematic font? BTW does the font size affect the glitches? Try changing font size using CTRL+wheel...Originally Posted by allstar
Rather unkind of you but as the screenshot looks pretty enough and there are a couple of good ideas exposed on the homepage so I may forgive you.
Among the important differences that you forgot to mention : the document model used is still QTextDocument (unless you changed your mind recently) hence poor performances and the source are vast and complicated to walk through while they do not offer that much more compared to QCodeEdit or QScintilla...
Current Qt projects : QCodeEdit, RotiDeCode
- Fixed inconsitency of cursor moves when cursor left the displayed area
- Fixed most (if not all) display glitches caused by variable width fonts
- Fixed replacement prompt to work as expected
- Fixed "double find" when searching forward and then backward (or the contrary)
- Added "auto refresh" of search context : changing the position of the cursor while the panel is visible will now affect the start point of the next search.
- Improved the speed of pageUp/pageDown by a factor 5 approximately by rewriting the related subroutines (may have fixed some bugs found when using these commands...)
That's all for now (until you report more bugs)
Current Qt projects : QCodeEdit, RotiDeCode
allstar (4th December 2007)
The new version is much better. QCodeEdit is amazing.
Unfortunately I found another bug: If you select some text and drag it, but NOT moving the mouse cursor from the selection, the text get copied right behind the selected text, when you release the mouse button. AFAIK this is not "normal" behaviour. The text shouldnt get coped when the mouse cursor is i still under the selected text.
Bookmarks