Skip to content

Conversation

spikey-pb
Copy link
Contributor

No description provided.

Copy link
Collaborator

@t-harter t-harter left a 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$, "^")
Copy link
Collaborator

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.

Copy link
Collaborator

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants