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
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
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. How do I de-underline it?
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:
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?
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.
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:
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();
})();
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.
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.
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”