[yast-commit] [libyui/libyui-ncurses] fc4a5d: Fix changing a single cell in a sorted table (bsc#...
Branch: refs/heads/table-cell-change Home: https://github.com/libyui/libyui-ncurses Commit: fc4a5df300d27f99cc1030ae21ac23c36f6dd474 https://github.com/libyui/libyui-ncurses/commit/fc4a5df300d27f99cc1030ae21ac... Author: Martin Vidner <mvidner@suse.com> Date: 2020-08-27 (Thu, 27 Aug 2020) Changed paths: M src/NCTable.cc M src/NCTablePad.cc M src/NCTablePad.h Log Message: ----------- Fix changing a single cell in a sorted table (bsc#1165388, bsc#1174615) This is a proper fix replacing the https://github.com/yast/yast-services-manager/pull/206 workaround. As reported:
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 <mvidner@suse.com> Date: 2020-08-27 (Thu, 27 Aug 2020) Changed paths: M src/NCTable.cc M src/NCTable.h M src/NCTableItem.cc M src/NCTableItem.h M src/NCTablePad.h Log Message: ----------- Document NCTable and friends Commit: 7bf24b4e311e86b9f9e1f979720047037115e049 https://github.com/libyui/libyui-ncurses/commit/7bf24b4e311e86b9f9e1f9797200... Author: Martin Vidner <mvidner@suse.com> Date: 2020-08-27 (Thu, 27 Aug 2020) Changed paths: M VERSION.cmake M package/libyui-ncurses-doc.spec M package/libyui-ncurses.changes M package/libyui-ncurses.spec Log Message: ----------- version + changelog Compare: https://github.com/libyui/libyui-ncurses/compare/245481b24765...7bf24b4e311e
participants (1)
-
Martin Vidner