.NET Forum / Visual Studio.NET / Extensibility / December 2005
BUG: IVsTextViewEvents.OnChangeCaretLine isn't called upon pressing ENTER ?
|
|
Thread rating:  |
Dmitry Shaporenkov - 20 Dec 2005 10:13 GMT Hi,
I've just run into a problem which seems to be caused by the fact that VS doesn't call my IVsTextViewEvents.OnChangeCaretLine callback when the user presses Enter and thus moves the caret to the next line. In my opinion, this is a bug, since the current line changes after pressing Enter. Can anybody from MS confirm if it is really a bug? Thanks in advance.
Regards, Dmitry Shaporenkov JetBrains, Inc http://www.jetbrains.com "Develop with pleasure!"
Dmitry Shaporenkov - 20 Dec 2005 11:20 GMT An update: not only this callback isn't called right after pressing ENTER, but it also isn't called when after pressing ENTER I move the caret to the previous line. That is, in the following scenario the callback isn't called at all: position the caret to a line, press Enter, move caret back to the original line.
I've found the following comment in the textmgr.idl file: /* New code should not use OnChangeCaretLine. If anything, you should use our new line commit events, IVsPreliminaryTextChangeCommitEvents and IVsFinalTextChangeCommitEvents. */
But I don't understand how can I use IVs*TextChangeCommitEvents instead of OnChangeCaretLine. My activity needs to happen in responce to a caret line change which is possible without any text changes.
And, finally, I'm using VS 2005.
Regards, Dmitry Shaporenkov JetBrains, Inc http://www.jetbrains.com "Develop with pleasure!"
> Hi, > [quoted text clipped - 14 lines] > http://www.jetbrains.com > "Develop with pleasure!" "Gary Chang[MSFT]" - 21 Dec 2005 03:11 GMT Hi Dmitry,
I don't think this is a product issue, if you press an "Enter" in the code editor, then an new line(new code) would be inserted into the current text, in this scenario, the IVsPreliminaryTextChangeCommitEvents should be called instead of the IVsTextViewEvents.OnChangeCaretLine.
>My activity needs to happen in responce to a caret line change >which is possible without any text changes. On the other hand, since you only want to respond to a caret line change without any text changes, so it appears the input of an "Enter" key would not be acceptable to your requirement, the IVsTextViewEvents.OnChangeCaretLine used to be appied in the scenarios of using direction arrow keys or the mouse or some other short-cut keys to change the line position of the caret...
Thanks!
Best regards,
Gary Chang Microsoft Community Support -------------------- Get Secure! ¡§C www.microsoft.com/security Register to Access MSDN Managed Newsgroups! http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp &SD=msdn
This posting is provided "AS IS" with no warranties, and confers no rights.
Dmitry Shaporenkov - 21 Dec 2005 05:50 GMT Hello Gary,
OK, may be this is by design, but in that case it's just odd. I realize that Enter inserts a new line, but after that it moves the caret to this line, and so it 'changes caret line' - meaning that OnChangeCaretLine should still be called. Just my opinion, of course.
Perhaps I wasn't clear enough - my activity needs to happen every time the caret moves to another line, regardless of what is the cause of this movement - mouse, arrow keys or Enter. Actually, my activity is simply highlighting of the current line in the editor with a specific background, so when the caret moves to another line, I should handle that. Of course I have to live with the current VSIP callbacks and handle OnChangeCaretLine and Enter separately. But it is not very convenient. And also, it would be nice that the situations in which OnChangeCaretLine is called would be documented in VSIP docs - I had to spend a good deal of time debugging and logging to realize the problem.
Thanks!
Regards, Dmitry Shaporenkov JetBrains, Inc http://www.jetbrains.com "Develop with pleasure!"
> Hi Dmitry, > [quoted text clipped - 28 lines] > This posting is provided "AS IS" with no warranties, and confers no > rights. Kajal Sinha - 21 Dec 2005 07:52 GMT Hi, even i am also facing the same issue. please help.
Dmitry Shaporenkov - 21 Dec 2005 13:22 GMT Hello Kajal,
not sure what help do you need, but there is a generic solution to similar problems - just poll the caret position periodically, say, once in 100 ms. You'll thus compensate for lack of VS events.
Regards, Dmitry Shaporenkov JetBrains, Inc http://www.jetbrains.com "Develop with pleasure!"
> Hi, > even i am also facing the same issue. please help. "Gary Chang[MSFT]" - 22 Dec 2005 07:20 GMT Hi Dmitry,
Such behavior is by design, and also the VSIP documentation problem is somehow not completed, we do understand the inconvenience that the VSIP developers felt in their daily work.
I will forward your concern to our corresponding product team for reconsideration, we are looking at continual improvement, and this feedback let us know what product features you required, thanks for your understanding and feedback!
Best regards,
Gary Chang Microsoft Community Support -------------------- Get Secure! ¡§C www.microsoft.com/security Register to Access MSDN Managed Newsgroups! http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp &SD=msdn
This posting is provided "AS IS" with no warranties, and confers no rights.
Dmitry Shaporenkov - 22 Dec 2005 15:22 GMT Thanks, Gary! I appreciate your work for VSIP developers.
Regards, Dmitry Shaporenkov JetBrains, Inc http://www.jetbrains.com "Develop with pleasure!"
> Hi Dmitry, > [quoted text clipped - 19 lines] > This posting is provided "AS IS" with no warranties, and confers no > rights. "Gary Chang[MSFT]" - 23 Dec 2005 01:44 GMT You are welcome, Dmitry, I am glad to discuss this issue with you:)
Merry Christmas!
Best regards,
Gary Chang Microsoft Community Support -------------------- Get Secure! ¡§C www.microsoft.com/security Register to Access MSDN Managed Newsgroups! http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp &SD=msdn
This posting is provided "AS IS" with no warranties, and confers no rights.
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|