Bike 1.4 Preview (75)

  • Added ability to edit link title in link popover
  • Added text content of row rich text scripting access
  • Fixed reading .html to better remove any list formatting marks
  • Fixed text picking bugs (click to select, move cursor up/down)
  • Fixed crash when working with some unicode characters such as “©️”
  • Fixed a some bugs in active/inactive window state tracking
  • Fixed case where right click on link button would not select link
  • Fixed case where pasting a link over selection would not add link

The new rich text property “text content” of row should make working with rich text attributes a lot easier. For example you can now:

tell front document of application "Bike"
	tell first row
		set bold of first word of text content to true
	end tell
end tell
tell front document of application "Bike"
	tell first row
		repeat with eachRun in attribute runs of text content
			set modelLink to link of eachRun
			log modelLink
			set viewLink to view link of eachRun
			log viewLink
		end repeat
	end tell
end tell

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

2 Likes

Hi Jesse,

As always, using Bike heavily and appreciate so much about it :smile:

I noticed that “select all below cursor” (Cmd + Shift + Down) causes the document to scroll to the top, the same behavior as “select all above cursor” (Cmd + Shift + Up). The text is correctly selected, but usually jumps suddenly out of view. Not a frequent action for me, but jarring when I’m expecting it to scroll to the bottom instead!

I see, I think I was trying to be too smart and scroll to selection rect… but that’s to big to fit into view in cases like that. Will get in a fix.

1 Like

JavaScript examples, with Jesse’s help:

(() => {
    "use strict";

    // ----- FIRST WORD OF FIRST ROW FORMATTED BOLD ------

    Application("Bike")
    .documents.at(0)
    .rows.at(0)
    .textContent.words.at(0)
    .bold = true;
})();

(() => {
    "use strict";

    // ----- ALL LINKS IN FRONT DOCUMENT, SORTED A-Z -----
    const
        runs = Application("Bike").documents.at(0)
        .rows.textContent.attributeRuns;

    console.log(
        [...runs.link(), ...runs.viewLink()]
        .flat()
        .filter(Boolean)
        .sort()
        .join("\n")
    );
})();

Or, FWIW, a variant preserving the order of links in the document:

(() => {
    "use strict";

    // -- ALL LINKS IN FRONT DOCUMENT, PRESERVING ORDER --

    const main = () => {
        const
            runs = Application("Bike").documents.at(0)
            .rows.textContent.attributeRuns;

        return console.log(
            Array.from(
                new Set(
                    zipWith(
                        a => b => a || b
                    )(
                        runs.link()
                    )(
                        runs.viewLink()
                    )
                    .flat()
                    .filter(Boolean)
                )
            )
            .join("\n")
        );
    };


    // --------------------- GENERIC ---------------------

    // zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
    const zipWith = f =>
    // A list constructed by zipping with a
    // custom function, rather than with the
    // default tuple constructor.
        xs => ys => xs.map(
            (x, i) => f(x)(ys[i])
        ).slice(
            0, Math.min(xs.length, ys.length)
        );

    // MAIN ---
    return main();
})();
3 Likes

Just realized that I labeled this thread incorrectly … the current preview release is #75 not #76. Thanks @blp

1 Like

This preview release is Bike 1.4 not 1.5, too :stuck_out_tongue:
(Title of here is “Bike 1.5 Preview (75)”, now…)

Yikes, fixed.

1 Like

Good news is I’m always making these sorts of errors, so if they are now being noticed (and not bugs in Bike) it must mean Bike 1.4 is getting close to release.

I’ve been fixing some scrolling bugs this morning. After that I have one more bug on my list, (an issue with line affinity being messed up by link buttons that I think no one has reported yet).

Do let me know if anyone is seeing other problems that should hold back 1.4. Time’s getting close (though I still have to do documentation and make a video and such).

1 Like

It is great :slight_smile:
One problem,

  1. Select some (not linked) text.

  2. Menu > Format > Add Link…
    or Menu > Format > Formatting…
    or cntrol + Click > Formatting…
    Click “Link text”

  3. => popover with [empty URL] [empty Title]
    (Ready for input to URL)

  4. Type URL and Click [Save Link]

  5. => Link with Selected text as “Link Title” (It is OK).

On Step 3. I think, “Title input_box” may be “Selected text” not empty.

This isn’t strictly a bug, but it’s disturbing. :frowning:

And…

4'. Type URL and type Title and Click [Save Link]
5'. => Link with typed text into the "Title" input_box as "Link Title".

It is OK :slight_smile:

@szshen This should be fixed in #76 I think:

1 Like

I felt weird for bringing it up. :laughing: