After updating position 0




















Lines 69 to 75 in bf4. That was my mistake. I updated to the latest graphql-dotnet preview and broke the DI container attempting to update to IServiceProvider. I've got this error message from the playground when executing a query. It is solved like below:. Skip to content. Star 5. New issue. Jump to bottom. Labels duplicate. Copy link.

Description We have a project that we are attempting to update to. Environment The text was updated successfully, but these errors were encountered:. Create a free Team What is Teams?

Collectives on Stack Overflow. Learn more. Asked 11 years, 6 months ago. Active 10 months ago. Viewed 15k times. I have an html textarea that will be updated periodically via javascript. Ben Noland. Ben Noland Ben Noland Add a comment. Active Oldest Votes. Thus trying to set the view's selection with editor. CaretOffset based on the results of the auto-complete snapshot which the view doesn't yet know about will fail to work properly. Instead of setting the CaretOffset property, you can do this kind of thing before your auto-completion's Apply call, and it will work:.

That allows you to specify what the resulting selection should be after the text change is applied. There it's saying it should be a zero-length selection at position 0, 5. I hope that helps explain why the event logic change was necessary and how to alter your selection code appropriately. In the data I obtained, I only know that the position of the cursor needs to be positioned at offset The content of myAutoCompleteChange.

Snapshot still does not change, which prevents me from getting the correct position after inserting the snippet. Yes, snapshots cannot be immediately updated in the view in auto-complete scenarios for the reason previously described where changed event handlers for the original primary text change were not able to fully complete prior to the auto-complete text change triggering another snapshot and its changed event handlers were all executed.

This would lead to some view and language services getting changed events firing out of snapshot version order, which could lead to problems, some of which could be bad. Due to the recent change, while the view hasn't yet updated itself to the latest document snapshot since the event handler where it updates hasn't executed yet in this scenario , the document itself will have the latest snapshot on its CurrentSnapshot property.

Thus instead of using editor. CurrentSnapshot, you should be able to look at editor. CurrentSnapshot instead. After myChange. Apply , I set the value of myChange. PostSelectionPositionRanges to reposition the cursor position. Achieved what I wanted, is this correct? NotifyDocumentTextChanged will affect. We have a lot of code to replace text and then position the cursor. But it seems that only part of it is affected. Yes, setting ITextChange.

PostSelectionPositionRanges is the best way to ensure the selection is at a specific place after any text change. Setting that property will work both before and after the change made in the prior version since PostSelectionPositionRanges is used after the text change is applied to the view. On that note, I would recommend setting it before you call ITextChange. Apply though.

Setting it after may work in this particular scenario since the changed event is getting buffered, but in normal circumstances when there isn't already a text change being processed, setting PostSelectionPositionRanges after Apply would be too late.

Right now only the view's DocumentTextChange events have been affected by the recent change, but looking into the core text model to possibly do something similar is something else we're considering, as the same core issue may still exist there where events could fire out of snapshot version order.

That is marked for investigation here. Even if that does change in the future, if you set PostSelectionPositionRanges prior to calling Apply , it should work fine in any scenario. If you have any other suggestions for how we can make some of this easier for you, while still handling the fundamental problem described in previous replies, feel free to post here and we can discuss further.

But as I mentioned earlier, the data for cursor repositioning may be an offset. Moses Mwongela Moses Mwongela 81 1 1 silver badge 6 6 bronze badges. It allows to avoid blinking on data update adapter. I was making a mistake like this, maybe it will help someone : If you use recyclerView. I have not used Recyclerview but I did it on ListView. BoltClock k gold badges silver badges bronze badges. The Original Android The Original Android 5, 3 3 gold badges 23 23 silver badges 31 31 bronze badges.

Okay, findFirstVisibleItemPosition returns "the adapter position of the first visible view", but what about the offset. Is there a similar method for Recyclerview to setSelection method of ListView for the visible position?

This is what I did for ListView. How about using setScrollY method with the dy parameter, a value which you will save? If it works, I'll update my answer.

I have not used Recyclerview but I want to in my future app. Please see my answer below on how to save the scroll position. Alright, I will keep that in mind next time, I didn't downvote you with malintent. However I disagree with short and incomplete answers because when I started out the short answers where other developers assumed a lot of background info did not really help me, because they were often too incomplete and I had to ask a lot of clarifying questions, something you usually cannot do on old stackoverflow posts.

Also notice how no answer was accepted by Konrad, which indicates that these answers did not solve his problem. Though I see your general point.

Show 5 more comments. Houssin Boulla Houssin Boulla 2, 1 1 gold badge 14 14 silver badges 18 18 bronze badges.

The onChanged method detects the action performed on recyclerview. Abhishek Chudekar Abhishek Chudekar 1 1 gold badge 6 6 silver badges 17 17 bronze badges. That's working for me in Kotlin. Chris Chris 2 2 silver badges 7 7 bronze badges. Jimale Abdi Jimale Abdi 2, 2 2 gold badges 19 19 silver badges 29 29 bronze badges. Changhoon Changhoon 3, 33 33 silver badges 61 61 bronze badges. Akhha8 Akhha8 9 9 bronze badges. I'd update the data and then after, call orderAdapter.

In using this method though, it made each individual item flash when it was updated so I also had to put this in the parent fragment's onCreateView RecyclerView. Matt Matt 61 5 5 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password.



0コメント

  • 1000 / 1000