Difference between revisions of "Talk:SynEdit"
From Free Pascal wiki
Jump to navigationJump to search (→Repl) |
m |
||
Line 1: | Line 1: | ||
− | = Repl = | + | = Repl example = |
− | + | ::: How to write examp, which replaces string from (x=2,y=10) to (x=4,y=20) with string S ? [[User:Alex22|Alex22]] | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ::: How to write examp, which replaces string from (x=2,y=10) to (x=4,y=20) with string S ? | ||
− | |||
:::: if x=2/y=10 are correct logical positions (1-based first byte pos of a char) | :::: if x=2/y=10 are correct logical positions (1-based first byte pos of a char) | ||
:::: (there is a unit that defines the function point / use codetools to find, it, or assign by hand to p.x/p.y of point) | :::: (there is a unit that defines the function point / use codetools to find, it, or assign by hand to p.x/p.y of point) | ||
− | :::: Last byte replaced is at x= | + | :::: Last byte replaced is at x=4 y=20 |
:::: SynEdit.TextBetweenPoints[point(2,10),point(4,20)] := s; | :::: SynEdit.TextBetweenPoints[point(2,10),point(4,20)] := s; | ||
:::: This is identical to setting the text selection, and replacing it. Except, this can keep the current selection. -- Martin | :::: This is identical to setting the text selection, and replacing it. Except, this can keep the current selection. -- Martin | ||
:::: Feel free to improve the example. But make sure people notice it is byte pos in utf8 | :::: Feel free to improve the example. But make sure people notice it is byte pos in utf8 |
Revision as of 20:32, 12 June 2014
Repl example
- How to write examp, which replaces string from (x=2,y=10) to (x=4,y=20) with string S ? Alex22
- if x=2/y=10 are correct logical positions (1-based first byte pos of a char)
- (there is a unit that defines the function point / use codetools to find, it, or assign by hand to p.x/p.y of point)
- Last byte replaced is at x=4 y=20
- SynEdit.TextBetweenPoints[point(2,10),point(4,20)] := s;
- This is identical to setting the text selection, and replacing it. Except, this can keep the current selection. -- Martin
- Feel free to improve the example. But make sure people notice it is byte pos in utf8