Bike 1.4 Preview (73)

  • Fixed crash when reading HTML content that contained empty lines
  • Fixed crash when hit testing multibyte characters such as emojis
  • Fixed html content of row (accessed via scripting) is no longer pretty printed
  • Fixed (by opting out) typing animations around link button because they were not correct

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


I’m hopeful that I’m getting close (again, but this time for real) to getting Bike rich text out the door. I still need to write documentation, screenshots, etc, but I don’t have any more “must do’s” on my programming list for this release. With that in mind please give it a try and let me know what “must do’s” I’m missing :slight_smile:

Jesse

1 Like

FWIW I’m still getting (in 73) a string index out of range crash when the cursor moves over a line containing Hebrew with vowel marks (nekudot).

(at least, I think it’s because of the vowel marks – XML below – or perhaps some interaction between RTL and formatting spans ?)

(Not seen in pre affinity-cursor builds)

So, for example, the unvowelled and unformatted middle line below (longest line), is absolutely fine, but I can crash build 73 by pasting in the text below, and moving the cursor over the first of those lines in which we have אוֹפַנַּיִם ('ofanayim – bicycle) with vowel marks, rather than אופנים without vowel marks.

אוֹפַנַּיִם שֵם ז"ר (בצורת זוגי)
כלי רכב בעל שני גלגלים בדרך כלל, המונע על-ידי דוושות המופעלות בכוח רגליו של הרוכב.
bicycle

Expand disclosure triangle to view XML source of crashing file
<?xml version="1.0" encoding="UTF-8"?>
<html>
  <head>
    <meta charset="utf-8"/>
  </head>
  <body>
    <ul id="JDHQrp68">
      <li id="gb">
        <p><span>אוֹפַנַּיִם  </span><span> </span><span> שֵם ז"ר (בצורת זוגי) </span><span> </span></p>
      </li>
      <li id="9W">
        <p></p>
      </li>
      <li id="la">
        <p/>
      </li>
      <li id="ae">
        <p>כלי רכב בעל שני גלגלים בדרך כלל, המונע על-ידי דוושות המופעלות בכוח רגליו של הרוכב.</p>
      </li>
      <li id="en">
        <p/>
      </li>
      <li id="Hk">
        <p>bicycle</p>
      </li>
    </ul>
  </body>
</html>

Zip of crashing file (Hebrew vowel marks, or RTL + spans seem to be the issue):
crash73_2022-09-21.bike.zip (1.3 KB)

Swift/StringCharacterView.swift:60: Fatal error: String index is out of bounds

Oops. I found some crashers in regular LTR text and though that fixed everything … looking into this case now.

1 Like

It looks like text sometimes gets underlined when it’s pasted from a website, even though I just wanted to paste it as plain text. Not sure if this is a bug or feature. :smiley: How do I de-underline it?

e.g.

1 Like

Empirically it’s clearable with Format > Clear Formatting, but I think it may be an unintended effect – no formatting tag seems to be appearing here in the underlying Bike XML.


At least not in the clipboard – in the saved file it shows up as:

<span view-marked="">
1 Like

:bug: spotted:

Setup:
image

Click the top triangle. This causes the line that previously contained the caret to continue to be visible for a while:

image

That doesn’t seem right, but I can’t reproduce it. Is there more to your example document than those two lines? Can you tell me how to recreate that bug from a new empty document?

Ahh two related problems.

First when reading pasted text I get .rtf formatted text… and I am mapping any background color to “highlight”. Unfortunately it looks like lots of pasted text has a background color set, so probably I don’t want to do that. Second bug is that I mapped to the wrong style … I applied style used for “marked” text (a view attributed not meant to be saved to model) when performing text input, not highlight.

If these underlines have got into your document use Format > Clear Formatting to remove them.

Will fix.

1 Like

If you are pasting a lot in the next few days, and need an interim fix, it is possible to specify a Paste As Plain Text Only using a Keyboard Maestro macro:

Paste as plain text.kmmacros.zip (2.1 KB)

or by attaching a keystroke to a script (language selector at upper left to JavaScript, if testing in Script Editor.app)

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

    // Recopy any plain UTF8 in the clipboard,
    // dropping other formats.

    ObjC.import("AppKit");

    const main = () =>
        bindLR(
            clipTextLR()
        )(
            copyText
        );

    // ----------------------- JXA -----------------------

    // clipTextLR :: () -> Either String String
    const clipTextLR = () => (
        v => Boolean(v) && 0 < v.length ? (
            Right(v)
        ) : Left("No utf8-plain-text found in clipboard.")
    )(
        ObjC.unwrap($.NSPasteboard.generalPasteboard
            .stringForType($.NSPasteboardTypeString))
    );

    // copyText :: String -> IO String
    const copyText = s => {
        // ObjC.import("AppKit");
        const pb = $.NSPasteboard.generalPasteboard;

        return (
            pb.clearContents,
            pb.setStringForType(
                $(s),
                $.NSPasteboardTypeString
            ),
            s
        );
    };

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

    // Left :: a -> Either a b
    const Left = x => ({
        type: "Either",
        Left: x
    });

    // Right :: b -> Either a b
    const Right = x => ({
        type: "Either",
        Right: x
    });

    // bindLR (>>=) :: Either a ->
    // (a -> Either b) -> Either b
    const bindLR = m =>
        mf => m.Left ? (
            m
        ) : mf(m.Right);

    return main();
})();

See: Using Scripts - Bike


( I personally use this quite a lot, in various contexts, and have it bound to ⌘⇧V )

2 Likes

Macro, script

Or – a better interim measure:

Just use Bike’s built-in Edit > Paste and Match Style ⌥⇧⌘V

:slight_smile:

1 Like

Hmm, I replicated it in a new document, but then restarted Bike and can’t replicate it again. That hints there’s potentially a stateful component to this one; will let you know if I find a way to reproduce it.

Thanks!

Not for “must do’s for Bike 1.4 rich text", but…

Item 1.
I think I’ve seen a “Shift-Command-Return” for “New Indent Row (or New Child Row?)” description or menu diagram somewhere on Bike.
Currently this keyboard shortcut works, but currently it doesn’t seem to be in the menu item or the description on “https://bikeguide.hogbaysoftware.com/”.
I think it would be nice to add it as a menu item. :slight_smile:

Item 2.
Currently these keyboard shortcuts works:

  • Option-Return and Shift-Option-Return for “New Top Level Row”
  • Control-Option-Return and Shift-Control-Option-Return for “Newline in the Row”

I think it would be nice to add it as a menu item, too. Or at least it might be better to explain in “https://bikeguide.hogbaysoftware.com/”. :slight_smile: