-
Notifications
You must be signed in to change notification settings - Fork 68
- Set caret location after a template insert using the ^ symbol. #332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Conversation
Remove a debug line I missed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice addition.
Could you also add a note to document this in the English help for the IDE?
See here: https://github.com/fantaisie-software/purebasic/blob/devel/Documentation/English/Reference/ide_tools.txt
SendEditorMessage(#SCI_REPLACESEL, 0, @Converted$) | ||
|
||
; Remove marker and move caret, if a position is specified. | ||
MarkerOffset = FindString(String$, "^") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to take care of possible UTF-8 encoding here (see the Format variable). The scintilla commands usually take byte offsets, not character positions. Best is to do some testing with accented or other special characters and try both UTF8 and Ascii to make sure both work right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I just noticed that the procedure you modified (InsertCodeString()
) is used in multiple places in the IDE. So placing this caret move code in there could have some side effect on another use case, maybe.
Why not add a new parameter to the procedure to enable/disable this behavior? This way it will not affect anything outside of the template functionality. You can make it an optional parameter so existing code does not need to be changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, done.
… into TemplatesCaret
No description provided.