You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "yescorp (via GitHub)" <gi...@apache.org> on 2023/02/03 04:55:20 UTC

[GitHub] [beam] yescorp commented on issue #25279: [Bug]: Cursor jumps when deleting a character in the default Python example

yescorp commented on issue #25279:
URL: https://github.com/apache/beam/issues/25279#issuecomment-1414952786

   Foldable block that is folded is no longer recognizable because of the unclosed multiline string. 
   Therefore, when we update the code inside `CodeController.setValue`, it is not the same as the text that is being edited.
   
   In `CodeController.setValue` we have:
   ```dart
   _updateCodeIfChanged(editResult.fullTextAfter);
   
   if (newValue.text != _code.visibleText) {
     // Manually typed in a text that has become a hidden range.
     newValue = newValue.replacedText(_code.visibleText);
   }
   ```
   
   Which changes selection according to 
   
   ```dart
   TextEditingValue replacedText(String newText) {
       if (newText == text) {
         return this;
       }
   
       final rangeAfter = newText.getChangedRange(
         text,
         attributeChangeTo: TextAffinity.upstream,
       );
   
       return TextEditingValue(
         text: newText,
         selection: TextSelection.collapsed(offset: rangeAfter.start),
       );
     }
   ```
   
   It seems useful in some cases, because just changing this led to failing test cases.


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org