[
https://issues.apache.org/jira/browse/BEAM-13755?focusedWorklogId=732251&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-732251
]
ASF GitHub Bot logged work on BEAM-13755:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 24/Feb/22 12:10
Start Date: 24/Feb/22 12:10
Worklog Time Spent: 10m
Work Description: miamihotline commented on a change in pull request
#16892:
URL: https://github.com/apache/beam/pull/16892#discussion_r813818784
##########
File path:
playground/frontend/lib/modules/editor/components/editor_textarea.dart
##########
@@ -133,44 +133,78 @@ class _EditorTextAreaState extends State<EditorTextArea> {
focusNode.requestFocus();
if (_codeController!.text.isNotEmpty) {
_codeController!.selection = TextSelection.fromPosition(
- TextPosition(offset: _findOffset()),
+ TextPosition(
+ offset: _getOffset(),
+ ),
);
}
}
- _findOffset() {
+ int _getOffset() {
+ int contextLine = _getIndexOfContextLine();
+ String pattern = _getPattern(_getQntOfStringsOnScreen());
+
+ if (pattern == '' || pattern == '}') {
+ return _codeController!.text.lastIndexOf(pattern);
+ }
+
return _codeController!.text.indexOf(
- _skipStrings(kNumberOfStringsToSkip),
- _getPositionAfterImportsAndLicenses(widget.sdk),
+ pattern,
+ contextLine,
);
}
- String _skipStrings(int qntOfStrings) {
- List<String> strings = _codeController!.text
- .substring(_getPositionAfterImportsAndLicenses(widget.sdk))
- .split('\n');
+ String _getPattern(int qntOfStrings) {
+ int contextLineIndex = _getIndexOfContextLine();
+ List<String> stringsAfterContextLine =
+ _codeController!.text.substring(contextLineIndex).split('\n');
+
String result =
- strings.length > qntOfStrings ? strings[qntOfStrings] : strings.last;
- if (result == '') {
- return _skipStrings(qntOfStrings - 1);
- } else {
- return result;
+ stringsAfterContextLine.length + kAdditionalLinesForScrolling >
+ qntOfStrings
+ ? _getResultSubstring(stringsAfterContextLine, qntOfStrings)
+ : stringsAfterContextLine.last;
+
+ return result;
+ }
+
+ int _getQntOfStringsOnScreen() {
+ RenderBox? rBox =
Review comment:
Thank you for the remark, I'll remove it.
--
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 732251)
Time Spent: 1h 20m (was: 1h 10m)
> Scroll the opened example to the context line
> ---------------------------------------------
>
> Key: BEAM-13755
> URL: https://issues.apache.org/jira/browse/BEAM-13755
> Project: Beam
> Issue Type: Sub-task
> Components: beam-playground
> Reporter: Artur Khanin
> Assignee: Alexander Zhuravlev
> Priority: P2
> Labels: beam-playground-frontend
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)