[yast-commit] [libyui/libyui-ncurses] fc4a5d: Fix changing a single cell in a sorted table (bsc#...
Branch: refs/heads/master
Home: https://github.com/libyui/libyui-ncurses
Commit: fc4a5df300d27f99cc1030ae21ac23c36f6dd474
https://github.com/libyui/libyui-ncurses/commit/fc4a5df300d27f99cc1030ae21ac...
Author: Martin Vidner
When I select for example auditd and change its Start Mode from "On Boot" to "(\*) Manually" (and/or its State from "Active (Running)" to "(\*) Inactive"), the item YaST2-Second-Stage (that is two lines above auditd) is visually marked as to be changed instead. But the change(s) will be actually correctly applied to auditd.
As can be seen from the description and behavior of the bug,
the misplaced table cells are consistently wrong, not just a one-time glitch
that would be fixed by scrolling away and back. Also, the data retrieved by
the application ends up correct.
That is because there are two sets of table items (lines): `NCTable` has a
collection of `YTableItem`, but does not draw them. `NCTable` instead has a
`NCTablePad` which has a collection of `NCTableLine` that get drawn.
How are the items identified? YaST uses ycp-ui-bindings to instantiate
`YCPTableItem` which are keyed by a `YCPValue` (usually a symbol). At
`ChangeWidget` time the key gets looked up, resulting in a pointer to a
`YTableItem` which has an integer id, its index at insertion
time. `NCTableLine` has its own copy of such id. And that is what enables this
bug fix: even though sorting the table rearranges the `NCTableLine`s we can
still query their `index` and thus identify the correct line (and cell).
![nctable v3](https://user-images.githubusercontent.com/102056/91312215-466e8880-e7b4-11ea...)
Commit: ef5ddd32b45885620f9b69bd2059b3018515cd2b
https://github.com/libyui/libyui-ncurses/commit/ef5ddd32b45885620f9b69bd2059...
Author: Martin Vidner
participants (1)
-
Martin Vidner