Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search window and search results improvements #37

Merged
merged 14 commits into from
Sep 29, 2024
Merged

Search window and search results improvements #37

merged 14 commits into from
Sep 29, 2024

Conversation

ptomato
Copy link
Owner

@ptomato ptomato commented Sep 17, 2024

No description provided.

ptomato added 14 commits August 19, 2024 20:37
I'm surprised that the compiler can't tell that relative_path is
initialized in every one of the three branches below. Oh well, just give
it a default value.
htmlSAXParseDoc() is deprecated and replaced by passing a HTML SAX parser
context to htmlCtxtReadDoc().

Pass flags (no network access) and free the document tree afterwards,
which should have been done previously.
Apparently at some point they contained a space, but no longer do. Use
sscanf() to be less sensitive to this and write the code more robustly.
Referencing email conversation about "Type" being an odd name for this
column.
The doc pages give a sort string, which we parsed but didn't use. Add a
GtkTreeModelSort which sorts the results as intended.
The anchor and example title pointers were copied over and freed twice.
Just don't use g_slice_dup(), it's too confusing about how the fields of
the struct are filled in and we need to overwrite most of them anyway.
In the search results window, a lot of visual space was taken up by
consecutive whitespace. Collapse it in html_to_ascii().

With this, we also no longer need to append spaces after <br> and <p>
elements.
Previously, the old search results wouldn't be cleared, and the new
results would appear among them.
A CellArea with two CellRendererText does not actually do what we want
here, because the renderers form their own columns within the cell.
These don't display any differently in the search results window, but they
should take you to the correct anchor when clicked.

For this we need to revisit our previous assumption that subsections are
not nested, and give Ctxt a stack of outer doctexts and contents, instead
of just one.
I suspect that this is already the default behaviour if we don't provide a
callback.
Without this, you'll get an error (and a blank row) if you search for a
term with an ampersand, or there is an ampersand around the term that you
search for.
Grabbing a certain number of bytes before and after the search term to
display will mostly work for English text. But not always! We might end up
chopping a multibyte character in half. Detect if this happens and shorten
the string not to include the invalid character.
@ptomato ptomato merged commit 12005fc into main Sep 29, 2024
1 check passed
@ptomato ptomato deleted the search-window branch September 29, 2024 00:27
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.

1 participant