Bike 1.14 (152)

Bike 152:

  • Moved choice view settings documention to user guide
  • Changed “Add Link to Row” shortcut to Option-Command-K
  • Changed Focus Heading to focus even rows that don’t have children
  • Changed Edit Formatting and Add Link to Row to not extend selection
  • Fixed “Add Link to Row” when linking top level rows
  • Fixed acroymn searches to match weaker for long items

Bike 1.14 Release Notes

Bike’s new “Focus Heading” feature enables quick navigation using only the keyboard. Watch the intro movie.

  • Added Go > Focus Heading… (Command-P)
  • Added Format > Add Link to Row… (Command-Option-K)
  • Added new row type shortcut [ ] (with space) for tasks
  • Added option to accept corrections, removing blue indicator
  • Added level property to rows in Shortcuts automations
  • Added xmlns" to html element in .bike files
  • Disabled autocorrect in code blocks and code spans
  • Changed Format > Add Link to use Command-K shortcut
  • Changed Go > Open Link to use Command-Shift-O shortcut
  • Changed Format > Edit Formatting to use Command-E shortcut
  • Changed to less distracting focus out button
  • Removed automatic crash reports
  • Fixed paste URL over text to work in applicable cases
  • Fixed “Use Selection for Find” to also show find panel
  • Fixed open empty .txt file in plain text format instead of Bike format
  • Fixed Formatting key shortcuts to work with Boshiamy text input
  • Fixed Typing using Boshiamy text input, though still some problems

To get preview releases through Bike’s software update select: Bike > Preferences > General > Include “preview” releases.

1 Like

More notes and thoughts on focus heading:

  • The match is fuzzy, for for example to match “Hello World” you can type “hw”
  • Keyboard shortcut is Command-P to match with what many code editors use
  • Go Home can now be replaced by Command-P followed by Enter.
  • After a few days of flailing around implementing my own slow version I decided to use the incredibly fast nucleo rust crate for the matching and scoring. It’s fast!
3 Likes

The fuzzy search is super useful already! :pray:

I did notice a possible regression from before, with links in the document – I can’t seem to make the “directional caret” appear for plain links pasted directly into an outline:

They do appear if I linkify some text, or eg. make something bold. But at the end of a line like the one above, if I press the right arrow the cursor moves directly to the next line.

I think this is correct behavior, because that is a “syntax highlighted” link. So there’s no associated attribute run to insert into. Instead the link is just being computed from the text content. Hope that makes sense.

Ah, thanks for explaining – I think it does. I had a mental model that if I pressed space and continued to type it would “extend the link”, but I see it just jumps the cursor out of the link and after the little arrow icon. Thanks!

I ran into this when trying to “move past the arrow icon” by pressing my right arrow key, but that would always jump me down to the next line, which is different from the other kind of links, and is why I thought something was up.

Edit: btw, just wanted to say that I really like the directional caret idea; it is always fun to see a new solution to an old problem like that, and it works very well in practice.

1 Like

LOVE LOVE LOVE this feature, first reaction is “I wish I could make the window that pops up a bit longer/bigger and have it stay that way”.

Second reaction is some of my ‘headings’ are blank, I assume because I like to space out my documents a bit.

If some of your blank lines are habitually ending up flagged as having a header type, you could assign a keystroke to a clean-up script. (Setting all blank header lines to the default body type).

Something, for example, like:

tell application "Bike"
    set doc to front document
    
    if doc exists then
        tell (rows of doc where its type is heading and its name is "")
            set n to count
            if 0 < n then
                set its type to body
                (n as string) & " blank rows set to body type."
            else
                "No blank header rows found."
            end if
        end tell
    else
        "No document open in Bike."
    end if
end tell

See: Using Scripts - Bike


For a script which automatically toggles (body type) white space between outline sections, you could try: Bike Outliner – Toggle empty rows between outline sections - Macro Library - Keyboard Maestro Discourse

2 Likes

PS re

I notice that blank headings only show up in the Go > Focus heading dialogue if they are not entirely empty, and contain some space characters.

Given that, the following JavaScript should provide a better clean-up

(To test in Script Editor, set the language selector at top left to JavaScript rather than AppleScript):

See: Using Scripts - Bike

Expand disclosure triangle to view JS source
(() => {
    "use strict";

    // Set the type of any empty heading rows in a Bike
    // document to "body".
    // ('empty' is interpreted as either no characters, or
    // only space characters).
    // Heading lines containing only spaces are trimmed,
    // as well as reset to `body`)

    // @RobTrew 2023
    // Ver 0.01

    const doc = Application("Bike").documents.at(0);

    return doc.exists()
        ? (() => {
            const
                nBlankHeads = doc.rows.where({
                    _match: [
                        ObjectSpecifier().type,
                        "heading"
                    ]
                })()
                .reduce(
                    (n, row) => "" === row.name().trim()
                        ? (
                            row.type = "body",
                            row.name = "",
                            1 + n
                        )
                        : n,
                    0
                );

            return 0 < nBlankHeads
                ? `${nBlankHeads} blank headings set to body type.`
                : `No empty headings found in "${doc.name()}".`;
        })()
        : "No documents open in Bike";
})();
2 Likes

A minor suggestion: Perhaps the Clear Formatting command should also revert the row type back to Body? Thanks for considering.

I’ve wondered about this, and wasn’t quite sure how it should work, so I delayed and didn’t implement anything.

I think it would be weird if you selected some bold text, chose clear formatting, and then the bold was removed AND the row type reset to default.

Maybe it should be a two step clear.

  1. Clear inline attributes.
  2. Clear row types

Skip directly to step 2 if there are not inline attributes. Seem reasonable?

You’re correct. Your proposed solution seems reasonable.

I also belatedly learned that I can just put the cursor at the start of the row and hit backspace to reset the row type to body—which is exactly what I was looking for when I posted the question (a keyboard shortcut to clear row type formatting). Sorry I missed it. :sweat_smile:

This took a while, but Bike 148 adds settings for choice views such as “Focus Heading”. Each different choice view can have different settings. So you can customize “Focus Heading” one way and customize a future (not yet implemented) “Link Row” choice view differently.

The settings consist of a display mode and an outline path to select the initial rows.

The display mode is either list or outline.

List is flat and matches are sorted by how closely they match the search. I think this flattened list is best when you have many rows that you are filtering and when you are not quite sure where you are going (because all the best matches show together). Another advantage of list is that you match against the entire path to root for each row, not just the row text.

Outline display mode shows results in outline order with indentation. This means it easier to understand the outline context of the results. I think this view is better for smaller lists that you might also want to browse via arrow keys without even filtering. For example this is the default view for “Focus Heading”. When you search the tree is filtered, but not reordered. Then the highest quality match is selected. Sometimes this works well, at other times it’s maybe a bit to jumpy when it scrolls to the highest quality match. Maybe I should take that part out … and just always select first match. Any thoughts?

The second goal is to allow you to configure what rows are show for each choice view. I’m doing that with an outline path… which I didn’t intend to work on this release, and which isn’t really done. But it seems good enough for this rather corner case. I’ll expand on it in Bike 1.15. I’m hoping that it’s easy enough to hack at to handle some of the cases that have come up.

The default “Focus Heading” settings path is:

//@type = "heading" or @level <= 1/ancestor-or-self::*

This has the effect of including any heading row, any level one row, and all ancestors of those matching rows in the set of initial rows. If you instead would like to also include level 2 rows in your “Focus Heading” list you can change @level <= 1 to @level <= 2 in the above query.

I thought I had done this… and in some cases you can see more rows (for example outline view), but maybe still need bigger?

3 Likes

:+1: thank you !

I just mean when I open the ‘focus heading’ window, I can’t click and drag on its edges to make it bigger/longer!

Just had an unrelated suggestion: Could the auto-strikethrough on task row types be turn-off-able? For my eyes, it’s a bit tough to read the items I’ve crossed off my list.

Yes, I agree, the strikethough is too much. As you note: not possible to read what the item was that was completed. I’d love it if “complete” offered an option to just turn the text gray instead of standard black. Then we’d know the item was done and wha the item was.

Currently I highligh all undone items. Then when an item is done I unhighlight it. Works decently well for me, but a better way to conver a finished task would be better.

I don’t want to add a specific setting for this, but it will eventually be possible through stylesheets.

Oh great point! I know I’m already looking forward to that future update.

Realized what the problem was: Horizontal rules! Each blank space in the focus heading menu for me is now a single ‘—’ elongated horizontal rule.

1 Like

Ah, good catch. I’ll filter those out too.