Coder Social home page Coder Social logo

Comments (3)

github-actions avatar github-actions commented on June 15, 2024

We found the following entry in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

from textual.

TomJGooding avatar TomJGooding commented on June 15, 2024

Just to note in case it is relevant, there are also a couple of existing issues relating to column widths:

from textual.

luked42 avatar luked42 commented on June 15, 2024

I've had some time to look a bit into this. Still getting familiar with the Textual framework so apologies for any oversights here.

From what I'm seeing / intuiting

Flow of code

  1. Selector key is hit
  2. self._set_hover_cursor(False) is called from action_select_cursor _data_table.py:2580. This ultimately queues a refresh of the current region
  3. main.py handles the redraw, clearing the table and readding rows (including the newly added row)
  4. The refresh/render line from step 2 is called, the column width (set to the max required for all rows) has not yet been updated yet, so DataTable renders using the old column width. Important to note here that we get called to render the lines that existed previous to step 3 (in terms of indices)
  5. _on_idle _data_table.py:1706 is now called where we have need to update dimensions. in _update_dimensions _data_table.py:1275 the column width is updated, additionally the virtual_size is updated to include the new row
  6. Compositor now calls for the extra line that was just added to be rendered as well. The previous rows how however not updated in this cycle

Minor points to note

  • if self._set_hover_cursor is not called in step one then the first render never happens and the entire table is re-rendered after the _on_idle call i.e it works fine.
    • My gut feel on this is that we're triggering the whole "current region" to refresh by clearing and adding the rows, otherwise I would have /thought/ thiat self._set_hover_cursor would only cause the selected row to refresh
  • I'm not yet familiar with the purpose of self._set_hover_cursor
  • If I trigger _on_idle from the redraw function (in a hacky way) it also works correctly as we've updated the column width before the render the first set of rows. Note that even if I do this still only the original set of rows and triggered to be rendered in the first cylce.
  • The reason other key bindings work to redraw is that they don't call self._set_hover_cursor / don't cause that premature render

from textual.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.