longturn / freeciv21

Develop your civilization from humble roots to a global empire
GNU General Public License v3.0
214 stars 39 forks source link

Do not rebuild contents when UWT table is updated #2305

Closed blabber closed 1 week ago

blabber commented 2 weeks ago

A timer triggers a periodic update of the UWT table in the unit view. Each update clears the current contents of the table and rebuilds it from scratch. As a result, the list loses its scrolling state and scrolls back up.

This PR changes the behavior to update existing entries and only selectively delete and add entries as needed.

To match units to their entries in the table, a hidden id column has been added to the UWT table.

Closes #2296

jwrober commented 2 weeks ago

Interesting approach. I'll give it a test.

blabber commented 2 weeks ago

Re-reading my diff, I noticed that I named the new variables using camelCase (the style we are using at my day job), this doesn't follow the style used in the existing code.

I will push an update later today to change these to snake_case, but this will be a purely cosmetic change.

hugomflavio commented 1 week ago

Tested #2305. UWT table scrolls nicely without rushing back up.

image