orbitalquark / textadept

Textadept is a fast, minimalist, and remarkably extensible cross-platform text editor for programmers.
https://orbitalquark.github.io/textadept
MIT License
636 stars 38 forks source link

Transforms in Textadept 12beta don't work as documented #419

Closed paaguti closed 1 year ago

paaguti commented 1 year ago

I have the following snippet:

@book{${1:key},
  ${2:/upcase}author = {${2:author}},
  ${3:pepe} --> ${3:/upcase}
}

I want to use the upcase transform but when using it, it expands as: Screenshot from 2023-07-04 07-34-30

Once navigated all fields I get:

Screenshot from 2023-07-04 07-38-26

I have a included a table dumper and when I parse the snippet, the resulting table is:

 k: 1; v: `@book{`
 k: 2
  k: index; v: `1`
  k: default
   k: 1; v: `key`
 k: 3; v: `,
  `
 k: 4
  k: index; v: `2`
  k: default
   k: 1; v: `/upcase`
 k: 5; v: `author = {`
 k: 6
  k: index; v: `2`
  k: default
   k: 1; v: `author`
 k: 7; v: `},
  `
 k: 8
  k: index; v: `3`
  k: default
   k: 1; v: `pepe`
 k: 9; v: ` --> `
 k: 10
  k: index; v: `3`
  k: default
   k: 1; v: `/upcase`
 k: 11; v: `
}
`

Note: the inverted hyphen in the table is used to delimit the values. If I look at the top at k: 4 I don't see any transform there, so it will not be found by self:each_placeholder(nil,'transform') in line 708.

As a matter of fact, it will only be used inside regular expressions, because the only time transform_methods is used is in line 671.

The more I dive into the code, the more confusing it is for me...

paaguti commented 1 year ago

I close this... I think this code dive was very productive and the code works as documented... Sorry for the noise.