]> git.gir.st - VimFx.git/commit
Implement filtering hints by text and related changes
authorSimon Lydell <simon.lydell@gmail.com>
Sat, 27 Aug 2016 15:58:44 +0000 (17:58 +0200)
committerSimon Lydell <simon.lydell@gmail.com>
Sat, 10 Sep 2016 02:18:24 +0000 (04:18 +0200)
commitae106db94dec4cbc81f52f2012dcb1ebd5e29356
treeb053c10e0dcaca8942e854c1ec5f14bb8cc04f94
parentfa50da6bfd9e2896a48d35edb131016b960e29a0
Implement filtering hints by text and related changes

This brings several more or less breaking changes:

- Non-hint chars now filter hint markers by the text of their elements,
  using an algorithm similar to the location bar (split the search term
  on whitespace; all the items must occur in the search text, case
  insensitively, and may overlap). The matched text is highlighted on
  screen. If all remaining hints are the same, they are automatically
  activated. All of this can be turned off via prefs, though.

- Since space is used to filter hint markers by element text, the
  already existing `<space>` shortcut for rotating hint markers had to
  be changed. It is now `<c-space>`. (`<s-space>` remains unchanged.)

- Uppercase hint chars are now allowed. This is so that people who
  prefer filtering by text in the first hand can use uppercase hint
  chars. If mixed case is used, `text-transform: uppercase;` is not
  applied, to avoid confusion.

- Since using uppercase characters for filtering hint markers by element
  text and lowercase characters for hint chars (or vice versa) is now a
  thing, holding shift no longer lets you peek through the hint markers,
  because that felt like the markers blinking all the time. Instead, you
  now have to hold shift+control to peek through.

- Hint markers are now placed immediately to left of its element's text
  if it would cover the text otherwise. This is because when filtering
  hints by text, it can be quite difficult to see what to type
  otherwise. This also turned out to be helpful even when only using the
  hints (like before). It’s nice being able to see all the link text in
  many cases.

- Hint markers now get their `z-index` assigned based on their element's
  area, not their weight. It's confusing when a smaller element's hint
  cover the hint of a larger element. This could be the case where there
  are lots of small profile image links all with the same `href`.
  Previously, all those links got `z-index` based on their combined
  area. Now, their individual areas are used instead. This problem
  became apparent because of the above bullet point.

- The hint marker(s) with the best hint are now highlighted in blue.

- `<enter>` now activates the highlighted marker(s). `<c-enter>` and
  `<a-enter>` can be used to toggle where links open, just as when
  using those modifiers with the last hint char. However, these
  shortcuts were already taken, so the old ones had to be given new
  shortcuts:

  - "Increase count" now uses `<up>` (instead of `<enter>`).
  - "Toggle complementary" now uses `<c-backspace>` (instead of
    `<c-enter>`).

- All existing hints prefs were renamed from starting with `hint_` or
  `hints_` to starting with `hints.`, for consistency and organization.
  A few new prefs starting with `hints.` were added as well. Migrations
  are written for this.

  This also unveiled a problem. If a config file tries to set an old
  pref and VimFx is upgraded, the config file will throw errors. This is
  bad user experience, so a system for allowing old names was added.
  However, that might mean that users never notice that they use an
  outdated name and never update their config files. Therefore, old
  names are only allowed when the config file is loaded automatically
  (on startup), but _not_ when it is reloaded using `gC`. The idea is
  that people use `gC` while working on their config file, which usually
  involves fixing errors. Then they could just as well fix the old pref
  names as well.

- The options in VimFx's settings page in the Add-ons Manager have been
  slightly re-ordered to play better with the new options added, and to
  promote some very important prefs to the top.

All of the above required some significant refactoring of Hints mode,
that should make it more robust.

Fixes #340. A big thanks to @doy who got this all started with #789.
41 files changed:
documentation/api.md
documentation/commands.md
documentation/config-file.md
documentation/options.md
documentation/questions-and-answers.md
extension/lib/api.coffee
extension/lib/commands-frame.coffee
extension/lib/commands.coffee
extension/lib/config.coffee
extension/lib/defaults.coffee
extension/lib/events-frame.coffee
extension/lib/events.coffee
extension/lib/help.coffee
extension/lib/hints-mode.coffee [new file with mode: 0644]
extension/lib/main.coffee
extension/lib/markable-elements.coffee
extension/lib/marker-container.coffee
extension/lib/marker.coffee
extension/lib/migrations.coffee
extension/lib/modes.coffee
extension/lib/parse-prefs.coffee
extension/lib/utils.coffee
extension/lib/viewport.coffee
extension/lib/vimfx.coffee
extension/locale/de/vimfx.properties
extension/locale/en-US/vimfx.properties
extension/locale/es/vimfx.properties
extension/locale/fr/vimfx.properties
extension/locale/id/vimfx.properties
extension/locale/it/vimfx.properties
extension/locale/ja/vimfx.properties
extension/locale/nl/vimfx.properties
extension/locale/pt-BR/vimfx.properties
extension/locale/ru/vimfx.properties
extension/locale/sv-SE/vimfx.properties
extension/locale/zh-CN/vimfx.properties
extension/locale/zh-TW/vimfx.properties
extension/skin/style.css
extension/test/test-api.coffee
extension/test/test-parse-prefs.coffee
extension/test/test-utils.coffee
Imprint / Impressum