Skip to content

Conversation

@cben
Copy link
Contributor

@cben cben commented Apr 7, 2023

caveat: Presently I'm just reading the code, not running it, so all untested.

  • See individual commits for why I believe the 2 removed comments don't match current reality.
  • The arg order in insert-cha-before-cha was clearly wrong.
    I don't see insert-cha-before-cha nor insert-cha-after-cha used anywhere.

cben added 3 commits April 7, 2023 18:28
…w array

Perhaps this was true once, but currently, this function does not
return a new chas-array (untested but afaict it returns nil),
and none of the 3 callers use its return value.

`chas-array-assure-room` ends up calling `grow-storage-vector` which can
extend the underlying storage-vector in place; so the chas-array identity
doesn't change.
…ctions

I don't see this holding in present code.
For example `insert-row-before-row` does not call `insert-row-at-row-no`.

Nor would this make sense algorithmically — rows are doubly-linked,
so holding a row pointer you have immediate access to the adjacent rows
whose pointers you need to adjust.
Whereas methods that take row numbers must walk the list to reach the
area to adjust.
Moreover, to compute the `row-row-no` index, you'd also need to walk it!

The opposite layering _could_ be reasonably efficient.
But in current code, it's not done either, e.g.
`insert-row-at-row-no` does all necessary set-*-row by itself.

- `append-row` does count `(length-in-rows self)` then calls
  `insert-row-at-row-no`, which will traverse the list again.
  But it's not strictly taking "existing box row", just a box.
UNTESTED!  But order of args was clearly wrong.
I don't see `insert-cha-before-cha` nor `insert-cha-after-cha` used anywhere.
@sgithens
Copy link
Member

Thanks @cben! I think this looks correct, will take a closer look at it shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants