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

Complete favourites #91

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Complete favourites #91

wants to merge 8 commits into from

Conversation

msdemlei
Copy link

This PR supersedes PR #89. It fixes it in two points:

  • I've cleaned it up (though I just notice I've cherry-picked the same commit twice -- I hope you don't mind)
  • It fixes the problem that -- as current xombrero history -- it wouldn't work in non-English locales.

The main point in this pull request is to enable tab completion of items
in the list of favourites.

To do this, the first three commits make the existing code for handling the
history generic enough so it can be used for the favourites, too.

The next commit actually manages the favourites list in memory; this results in
a change in the favourite file's on-disk format. There was code for
heuristically deciding what's what, but see below.

Then (9def345), the in-memory favourites are used to complete URIs,
which really is what (amost) all this is about; the new behaviour is
then made configurable in the following commit via the new config option
complete_uri_anywhere defaulting to false (current xombrero behaviour).
If you set it to 1, URI expansion will happen based on matches anywhere
in the URIs.

The current history format uses ctime in serialisation, but strptime with
locale-dependent input field descriptors in deseerialisation, which made it
break in non-English locales. With this proposal, this breakage would
have extended to favourites, so I'm fixing it in the final commit.
Essentially, with it xombrero pagelists would then start with a magic
and have ISO-style dates. The loaders check for the magic and, in this
commit, fall back to the legacy parsers if they don't find it.

One drawback mentioned in #89 remains: As in current HEAD, there are
two sources of URL completion: The completion model from complete.h, and
the manual stuff in cmd_getlist. The fact that completion_add_uri
didn't have an effect on completing "open" was really confusing to me.
Alas, I've not found an API to get to harmless char* to memory held
within a GtkTreeView, and, though I've not really investigated that, I
believe they can't sling around pointers to memory owned by them as it
could be freed essentially at any time. So, we'd have to teach
cmd_getlist to (conditionally?) free its stuff. I'm not sure whether
that effort is worth it, and maybe it's even right to have two methods
because they're really doing different things (but then a comment in
completion.c would be of great public service).

Renaming struct history to struct pagelist_entry
There is support for reading history in the legacy format, with
an ad-hoc detection of the legacy format that really sucks.
There is support for reading history in the legacy format, with
an ad-hoc detection of the legacy format that really sucks.
Also, minor fixes in loading new-style favourites.
This fixes a bug that rendered saved histories unparseable in non-C
locales.  The legacy formats are stilled tried/parsed if the magic is
missing.
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