leehaut opened a new pull request, #7780:
URL: https://github.com/apache/hop/pull/7780

   Fix https://github.com/apache/hop/issues/5321
   
   ## Summary
   - Fix double-click field/function insertion in the expression editor so a 
selected range is replaced correctly regardless of selection direction 
(left-to-right vs right-to-left).
   - Replace the caret/`substring`/`setText` logic with `StyledText.insert()`, 
which handles selection replacement properly and avoids wiping undo history.
   - Apply the same fix to both User Defined Java Expression (`janino`) and 
Formula editor dialogs.
   
   ## Root cause
   The double-click handler treated `getCaretPosition()` as the start of the 
selection. When text is selected left-to-right, the caret is at the *end* of 
the selection, so the inserted field name was appended after the selection 
instead of replacing it.
   
   Example:
   - Expression: `isOk? 1: 0`
   - Select `1` left → right, double-click field `name` → `isOk? 1name: 0` 
(wrong)
   - Select `1` right → left, double-click field `name` → `isOk? name: 0` 
(correct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to