chiark / gitweb /
mastodonochrome.git
2 years agoMedia entries.
Simon Tatham [Tue, 26 Dec 2023 09:20:45 +0000 (09:20 +0000)]
Media entries.

2 years agoUserListEntry, which was easy
Simon Tatham [Tue, 26 Dec 2023 09:01:17 +0000 (09:01 +0000)]
UserListEntry, which was easy

2 years agoNotification log formatting
Simon Tatham [Tue, 26 Dec 2023 07:57:03 +0000 (07:57 +0000)]
Notification log formatting

2 years agoRe: header.
Simon Tatham [Mon, 25 Dec 2023 21:16:03 +0000 (21:16 +0000)]
Re: header.

2 years agoExtendableIndicator, without the hard part
Simon Tatham [Mon, 25 Dec 2023 20:43:55 +0000 (20:43 +0000)]
ExtendableIndicator, without the hard part

2 years agoDiagnose unsupported markup tags
Simon Tatham [Mon, 25 Dec 2023 20:06:24 +0000 (20:06 +0000)]
Diagnose unsupported markup tags

2 years agoAha, Iterator::position is a bit nicer
Simon Tatham [Mon, 25 Dec 2023 19:58:15 +0000 (19:58 +0000)]
Aha, Iterator::position is a bit nicer

2 years agoFirst-draft HTML parser
Simon Tatham [Mon, 25 Dec 2023 16:16:11 +0000 (16:16 +0000)]
First-draft HTML parser

2 years agoGet the QualNames out of my html::Receiver.
Simon Tatham [Mon, 25 Dec 2023 15:56:39 +0000 (15:56 +0000)]
Get the QualNames out of my html::Receiver.

2 years agopush_para
Simon Tatham [Mon, 25 Dec 2023 15:56:08 +0000 (15:56 +0000)]
push_para

2 years agoFileHeader text implementation
Simon Tatham [Mon, 25 Dec 2023 15:55:47 +0000 (15:55 +0000)]
FileHeader text implementation

2 years agoRender paragraphs by wrapping them.
Simon Tatham [Mon, 25 Dec 2023 13:12:45 +0000 (13:12 +0000)]
Render paragraphs by wrapping them.

2 years agoBuild paragraphs, in a bodgy slow way.
Simon Tatham [Mon, 25 Dec 2023 10:42:14 +0000 (10:42 +0000)]
Build paragraphs, in a bodgy slow way.

For the moment, I've made a CharIterator that returns each coloured
character of a ColouredString one by one. That's nasty, but easy. I
think more ideally I'd want an iterator that returned contiguous
chunks of a ColouredString according to a filter function passed in
that classifies characters as wanting to be in the same chunk. But
that involves function parameters, so I can try that later.

2 years agoFactor out truncation of a ColouredString
Simon Tatham [Sun, 24 Dec 2023 22:29:48 +0000 (22:29 +0000)]
Factor out truncation of a ColouredString

2 years agoUsername headers
Simon Tatham [Sun, 24 Dec 2023 22:13:47 +0000 (22:13 +0000)]
Username headers

2 years agoEditorHeaderSeparator, which is really easy
Simon Tatham [Sun, 24 Dec 2023 21:48:03 +0000 (21:48 +0000)]
EditorHeaderSeparator, which is really easy

2 years agoSeparatorLine (with proper date formatting!)
Simon Tatham [Sun, 24 Dec 2023 21:26:32 +0000 (21:26 +0000)]
SeparatorLine (with proper date formatting!)

2 years agoMore ColouredString stuff I needed
Simon Tatham [Sun, 24 Dec 2023 21:26:23 +0000 (21:26 +0000)]
More ColouredString stuff I needed

2 years agoStart of the text module.
Simon Tatham [Sun, 24 Dec 2023 21:07:45 +0000 (21:07 +0000)]
Start of the text module.

2 years agoOh wait I don't need to _implement_ Eq
Simon Tatham [Sun, 24 Dec 2023 21:01:13 +0000 (21:01 +0000)]
Oh wait I don't need to _implement_ Eq

2 years agoMaybe the version with slices?
Simon Tatham [Sun, 24 Dec 2023 16:46:59 +0000 (16:46 +0000)]
Maybe the version with slices?

2 years agoBasic version of split.
Simon Tatham [Sun, 24 Dec 2023 16:08:43 +0000 (16:08 +0000)]
Basic version of split.

Returns a newly allocated ColouredString. Perhaps it would be nice to
be able to return a lighter-weight thing containing a pair of &str?

2 years agoSuccessful frags iterator!
Simon Tatham [Sun, 24 Dec 2023 15:41:55 +0000 (15:41 +0000)]
Successful frags iterator!

2 years agoMore, but still not finished
Simon Tatham [Sun, 24 Dec 2023 13:48:15 +0000 (13:48 +0000)]
More, but still not finished

I'm not at all sure that counting by chars is what I really want, hmmm.

2 years agoUNFINISHED: ColouredString class.
Simon Tatham [Sun, 24 Dec 2023 13:37:48 +0000 (13:37 +0000)]
UNFINISHED: ColouredString class.

2 years agoOK, now it doesn't.
Simon Tatham [Sat, 23 Dec 2023 20:35:50 +0000 (20:35 +0000)]
OK, now it doesn't.

Looks as if the only problem there was trying to link the document
root to itself.

2 years agoTry walking the tree. It crashes, oops.
Simon Tatham [Sat, 23 Dec 2023 20:01:06 +0000 (20:01 +0000)]
Try walking the tree. It crashes, oops.

2 years agoAbandon html2text and try html5ever.
Simon Tatham [Sat, 23 Dec 2023 18:26:56 +0000 (18:26 +0000)]
Abandon html2text and try html5ever.

I _think_ this gets me a tree structure containing the HTML DOM. Now I
have to do the same formatting and wrapping that I'm doing in the
Python version, but that really should just be a matter of conversion.

2 years agoNow the scanners seem to be working!
Simon Tatham [Sat, 23 Dec 2023 17:04:36 +0000 (17:04 +0000)]
Now the scanners seem to be working!

2 years agoFirst cut at transcribing the scanning regexes.
Simon Tatham [Sat, 23 Dec 2023 16:31:06 +0000 (16:31 +0000)]
First cut at transcribing the scanning regexes.

2 years agoFirst cut at parsing HTML of a toot.
Simon Tatham [Sat, 23 Dec 2023 15:22:29 +0000 (15:22 +0000)]
First cut at parsing HTML of a toot.

But it doesn't work right, because the CSS is ignored. I think that's
because html2text only processes CSS classes on <span> elements, not
on <a> where the Mastodon server puts them.

2 years agoNow we can draw directly without ratatui widgets.
Simon Tatham [Sat, 23 Dec 2023 14:41:57 +0000 (14:41 +0000)]
Now we can draw directly without ratatui widgets.

I didn't really want to have to structure my program around their
widget API, and now I don't have to.

2 years agoLooks as if this is the best way to go beep!
Simon Tatham [Sat, 23 Dec 2023 14:29:09 +0000 (14:29 +0000)]
Looks as if this is the best way to go beep!

2 years agoSet up ratatui and demonstrate event handling.
Simon Tatham [Sat, 23 Dec 2023 14:16:22 +0000 (14:16 +0000)]
Set up ratatui and demonstrate event handling.

I've had to put the event-reading in another thread, because I
couldn't see any way to tie extra fds into ratatui's poll loop. So
instead I'm going to have to make subthreads communicate to the main
loop via an interthread channel.

2 years agoUpdate .gitignore.
Simon Tatham [Sat, 23 Dec 2023 12:56:07 +0000 (12:56 +0000)]
Update .gitignore.

2 years agoProcess raw stream data into UTF-8 lines.
Simon Tatham [Sat, 23 Dec 2023 12:51:03 +0000 (12:51 +0000)]
Process raw stream data into UTF-8 lines.

2 years agoGet rid of the rest of the unwraps.
Simon Tatham [Sat, 23 Dec 2023 12:36:52 +0000 (12:36 +0000)]
Get rid of the rest of the unwraps.

2 years agoMade auth file handling fallible.
Simon Tatham [Sat, 23 Dec 2023 12:29:03 +0000 (12:29 +0000)]
Made auth file handling fallible.

There are no doubt many ways to do it better, but this is a start -
now it will at least print what went wrong.

2 years agoMove auth file handling out into a module.
Simon Tatham [Sat, 23 Dec 2023 12:14:50 +0000 (12:14 +0000)]
Move auth file handling out into a module.

It ought to be fallible, though.

2 years agoTry using xdg to get the config directory location.
Simon Tatham [Sat, 23 Dec 2023 11:58:04 +0000 (11:58 +0000)]
Try using xdg to get the config directory location.

2 years agoReplace copy_to with direct use of the Read trait
Simon Tatham [Sat, 23 Dec 2023 11:52:07 +0000 (11:52 +0000)]
Replace copy_to with direct use of the Read trait

2 years agoFirst demo of a streaming API working.
Simon Tatham [Sat, 23 Dec 2023 11:37:08 +0000 (11:37 +0000)]
First demo of a streaming API working.

Had to bodgily pull in the Python version's auth data for this, but
it's a start. I can sort that part out properly later.

2 years agoMove the types out into a separate module.
Simon Tatham [Sat, 23 Dec 2023 11:15:28 +0000 (11:15 +0000)]
Move the types out into a separate module.

2 years agoExperimented with a reqwest Client.
Simon Tatham [Sat, 23 Dec 2023 11:15:12 +0000 (11:15 +0000)]
Experimented with a reqwest Client.

2 years agoOK, that's probably enough data modelling for now
Simon Tatham [Sat, 23 Dec 2023 11:03:18 +0000 (11:03 +0000)]
OK, that's probably enough data modelling for now

2 years agoDeserialise visibility, with compiler warnings
Simon Tatham [Sat, 23 Dec 2023 10:53:58 +0000 (10:53 +0000)]
Deserialise visibility, with compiler warnings

2 years agoGot most of the dates, but what about last_status_at?
Simon Tatham [Sat, 23 Dec 2023 10:23:57 +0000 (10:23 +0000)]
Got most of the dates, but what about last_status_at?

2 years agoFill in some more parts of the main structures
Simon Tatham [Sat, 23 Dec 2023 10:16:46 +0000 (10:16 +0000)]
Fill in some more parts of the main structures

2 years agoSelf-reference to subthings via Box
Simon Tatham [Sat, 23 Dec 2023 10:16:33 +0000 (10:16 +0000)]
Self-reference to subthings via Box

2 years agoCope with some optional fields
Simon Tatham [Sat, 23 Dec 2023 10:11:50 +0000 (10:11 +0000)]
Cope with some optional fields

2 years agoDecode a sample Status as well as an Account
Simon Tatham [Sat, 23 Dec 2023 10:08:41 +0000 (10:08 +0000)]
Decode a sample Status as well as an Account

2 years agoPoC of retrieving and unpacking a struct.
Simon Tatham [Sat, 23 Dec 2023 10:02:10 +0000 (10:02 +0000)]
PoC of retrieving and unpacking a struct.

2 years agoBegin setting up a Rust framework.
Simon Tatham [Sat, 23 Dec 2023 09:45:09 +0000 (09:45 +0000)]
Begin setting up a Rust framework.

2 years agoFix the various 'user's posts' variations.
Simon Tatham [Fri, 22 Dec 2023 10:18:55 +0000 (10:18 +0000)]
Fix the various 'user's posts' variations.

By generalising the True/False -> true/false mapping across all
booleans submitted as request parameters.

2 years agoSupport <pre> tag in post HTML.
Simon Tatham [Sun, 17 Dec 2023 11:49:58 +0000 (11:49 +0000)]
Support <pre> tag in post HTML.

2 years agoOption to view a post by its numeric id.
Simon Tatham [Sun, 17 Dec 2023 11:39:12 +0000 (11:39 +0000)]
Option to view a post by its numeric id.

2 years agoMore timelines.
Simon Tatham [Sun, 17 Dec 2023 09:22:08 +0000 (09:22 +0000)]
More timelines.

These don't auto-update.

2 years agoGraduations of mode to view a user's posts.
Simon Tatham [Sun, 17 Dec 2023 07:49:15 +0000 (07:49 +0000)]
Graduations of mode to view a user's posts.

Now we can exclude blogs, and also exclude replies to other threads.

(Interestingly, the 'exclude replies' flag in the API only excludes
replies to _other_ accounts. So it keeps replies to _yourself_. One
effect of this is that if you post a multitoot thread, it all shows up
in this list. Of course the client could filter it too...)

2 years agoFix a few NoneType errors.
Simon Tatham [Fri, 15 Dec 2023 17:30:26 +0000 (17:30 +0000)]
Fix a few NoneType errors.

2 years agoChange my mind about how to extend backwards.
Simon Tatham [Fri, 15 Dec 2023 12:25:47 +0000 (12:25 +0000)]
Change my mind about how to extend backwards.

I think pressing [0] at the top of the file is better than double-[B].
Firstly, it's fewer keystrokes to do on purpose; secondly, it's not a
key you would have been repeating already. Now I can hold down [B]
safely to page up through the existing text, _and_ if I want to keep
extending backwards I can do it more easily than before.

2 years agoFix out-of-bounds access in files shorter than the screen
Simon Tatham [Fri, 15 Dec 2023 08:11:38 +0000 (08:11 +0000)]
Fix out-of-bounds access in files shorter than the screen

2 years agoLists of followers, folllowees, favers and boosters.
Simon Tatham [Fri, 15 Dec 2023 07:56:14 +0000 (07:56 +0000)]
Lists of followers, folllowees, favers and boosters.

2 years agoSupport <blockquote> in HTML.
Simon Tatham [Thu, 14 Dec 2023 22:40:13 +0000 (22:40 +0000)]
Support <blockquote> in HTML.

2 years agoAhem, fix last minute breakage.
Simon Tatham [Thu, 14 Dec 2023 20:23:25 +0000 (20:23 +0000)]
Ahem, fix last minute breakage.

2 years agoFirst cut at viewing a user's posts.
Simon Tatham [Thu, 14 Dec 2023 19:05:58 +0000 (19:05 +0000)]
First cut at viewing a user's posts.

2 years agoChange wording from 'Reply' to 'Send' for non-statuses.
Simon Tatham [Thu, 14 Dec 2023 19:05:33 +0000 (19:05 +0000)]
Change wording from 'Reply' to 'Send' for non-statuses.

You might be sending a message to the named user, but you're not
_replying_ to anything of theirs.

2 years agoFirst cut at Examine User.
Simon Tatham [Thu, 14 Dec 2023 18:20:24 +0000 (18:20 +0000)]
First cut at Examine User.

Currently you can only type in names to examine by hand.

2 years agoExperimental ^K change of behaviour.
Simon Tatham [Thu, 14 Dec 2023 18:20:24 +0000 (18:20 +0000)]
Experimental ^K change of behaviour.

If you press ^K to delete to end of line and you're in mid-paragraph,
I think not a bad answer is to _insert_ a paragraph break, so that the
text on the next line doesn't unexpectedly wrap.

This is intuitively as close as possible to the behaviour in the
non-auto-wrapping 'me'. The only thing I don't like about it is that
pasting the text back in again with ^Y doesn't delete the line break,
but I haven't thought of a less astonishing answer to that yet.

2 years agoTests of Ctrl-K.
Simon Tatham [Thu, 14 Dec 2023 18:20:24 +0000 (18:20 +0000)]
Tests of Ctrl-K.

So I can refactor it.

2 years agoFix goof in IndentedParagraph.
Simon Tatham [Thu, 14 Dec 2023 18:20:24 +0000 (18:20 +0000)]
Fix goof in IndentedParagraph.

2 years agoHTML formatting: support <i>.
Simon Tatham [Thu, 14 Dec 2023 18:20:24 +0000 (18:20 +0000)]
HTML formatting: support <i>.

Same as <em>, of course.

2 years agoSome more TODO comments.
Simon Tatham [Thu, 14 Dec 2023 18:20:24 +0000 (18:20 +0000)]
Some more TODO comments.

2 years agoMatch reply visibility to the incoming message.
Simon Tatham [Thu, 14 Dec 2023 17:35:21 +0000 (17:35 +0000)]
Match reply visibility to the incoming message.

I had a conversation in 'unlisted' status with someone, and it was a
pain to keep setting this by hand.

Of course, it's only a default: you _can_ change the visibility in a
reply.

2 years agoPost info: add list of mentioned users.
Simon Tatham [Mon, 11 Dec 2023 19:11:04 +0000 (19:11 +0000)]
Post info: add list of mentioned users.

Because the post itself doesn't show their fully qualified usernames.

2 years agoSecond thoughts, remove that assertion again.
Simon Tatham [Sun, 10 Dec 2023 22:46:02 +0000 (22:46 +0000)]
Second thoughts, remove that assertion again.

Turns out that Composer does want to keep the entire editor buffer in
a ColouredString so that it can colourise it as a whole. And that can
include \n. We do want to keep \n away from add_wch, but keeping it
out of ColouredString entirely isn't a workable approach.

Oh well. The immediate crash is fixed, at least.

2 years agoSquelch literal \n appearing in post HTML.
Simon Tatham [Sun, 10 Dec 2023 22:15:16 +0000 (22:15 +0000)]
Squelch literal \n appearing in post HTML.

For some reason this doesn't happen very often, but I just saw it for
the first time, and it totally confused Paragraph and also
ColouredString.frags. Avoid getting into that sitation in the first
place.

2 years agoFix missing screen refresh when new posts arrive.
Simon Tatham [Sun, 10 Dec 2023 15:32:16 +0000 (15:32 +0000)]
Fix missing screen refresh when new posts arrive.

The rework of resize handling had the accidental side effect that when
the self-pipe from the stream-watching thread signals us, we do call
extend_future() on our feeds, but we _don't_ loop back round to the
screen redraw, so that if the user is sitting in their home timeline,
the bottom line of the screen doesn't update to show that new stuff is
available.

2 years agoFix file-position stability over backward extend.
Simon Tatham [Sat, 9 Dec 2023 18:44:21 +0000 (18:44 +0000)]
Fix file-position stability over backward extend.

That last-minute idea to bound pos_within_item within the actual size
of the item ... forgot that each logical item (e.g. a status) is made
up of multiple physical items (paragraphs, separator line, etc), so I
bounded it within _those_ and made a mess. Should be back to normal now.

2 years agoImplement searching in the file pager.
Simon Tatham [Sat, 9 Dec 2023 18:31:26 +0000 (18:31 +0000)]
Implement searching in the file pager.

2 years agoFix display of whether you've boosted something.
Simon Tatham [Sat, 9 Dec 2023 18:05:22 +0000 (18:05 +0000)]
Fix display of whether you've boosted something.

I had forgotten for a moment that it's called something else at the
protocol level.

2 years agoAllow changing the visibility of posts.
Simon Tatham [Sat, 9 Dec 2023 17:57:32 +0000 (17:57 +0000)]
Allow changing the visibility of posts.

2 years agoAllow tagging posts with a content warning.
Simon Tatham [Sat, 9 Dec 2023 17:41:09 +0000 (17:41 +0000)]
Allow tagging posts with a content warning.

2 years agoAdd 'change language' in the pre-posting menu.
Simon Tatham [Sat, 9 Dec 2023 16:43:41 +0000 (16:43 +0000)]
Add 'change language' in the pre-posting menu.

Uses the new bottom-line editor to prompt for a replacement language
tag.

2 years agoAbility to prompt on the bottom screen line.
Simon Tatham [Sat, 9 Dec 2023 16:16:14 +0000 (16:16 +0000)]
Ability to prompt on the bottom screen line.

2 years agoFeature to print detailed info about a status.
Simon Tatham [Sat, 9 Dec 2023 15:44:00 +0000 (15:44 +0000)]
Feature to print detailed info about a status.

Now I can retrieve its URL to send to people, and find out all the
fiddly internals too.

2 years agoCope with a timeline not containing any posts!
Simon Tatham [Sat, 9 Dec 2023 15:56:31 +0000 (15:56 +0000)]
Cope with a timeline not containing any posts!

Of course, that's the first thing that happens when you log in to a
fresh Mastodon test instance.

2 years agoOverride for config directory.
Simon Tatham [Sat, 9 Dec 2023 15:42:44 +0000 (15:42 +0000)]
Override for config directory.

This provides a crude means of managing multiple accounts. At the
moment my only use case for this is logging in to a test server so
that I can test the fine points of posting without making a fool of
myself on the live fediverse. So I don't need to run the accounts in
parallel in a user-friendly way, and I can easily just pass a weird
command-line option when I'm doing testing.

2 years agoFix resizing the window smaller.
Simon Tatham [Sat, 9 Dec 2023 12:22:23 +0000 (12:22 +0000)]
Fix resizing the window smaller.

Some weird sequence of events was triggering an attempted redraw at
the old size, before properly noticing the change and redrawing at the
new size. When going from smaller to bigger this just caused a display
flicker (in fact not even a perceptible one), but bigger to smaller
caused an exception when we tried to draw a big screen in a small
window and curses caught us printing outside the screen area.

Now seems to work better.

2 years agoBodgy fix for poor performance of wcwidth.
Simon Tatham [Fri, 8 Dec 2023 17:56:45 +0000 (17:56 +0000)]
Bodgy fix for poor performance of wcwidth.

Mastodonochrome was running rather slowly, and when I profiled it, it
turned out the bottleneck was the 'wcwidth' Python module, which is
not a wrapper on the C function, but a reimplementation in pure Python
and therefore not very fast.

I've bodged it by just making one big cache of all the strings that
the program ever passes to wcwidth, since there were only two calls to
that function at all and they were both in text.py. I don't know if
that's the right fix in the long term, but it seems to have improved
things considerably for now.

(Also, while I'm at it, ColouredString now wcwidths its contents once
at construction time and doesn't redo it on every call, so it doesn't
even look up the same thing in the cache multiple times.)

2 years ago^K and ^Y for copy and paste to end of line.
Simon Tatham [Fri, 8 Dec 2023 12:59:59 +0000 (12:59 +0000)]
^K and ^Y for copy and paste to end of line.

Well, end of _paragraph_, for the moment. Perhaps end of line would be
better. But my immediate use cases won't care about the difference:

 - ^W^K to delete the last word I typed at the end of a paragraph
 - dealing with code snippets which don't wrap anyway

2 years agoEditor: ^W and ^T to go forward/back a word
Simon Tatham [Fri, 8 Dec 2023 12:56:48 +0000 (12:56 +0000)]
Editor: ^W and ^T to go forward/back a word

2 years agoProperly indicate whether we can extend backwards.
Simon Tatham [Fri, 8 Dec 2023 12:50:31 +0000 (12:50 +0000)]
Properly indicate whether we can extend backwards.

2 years agoAbility to retrieve the thread of a post.
Simon Tatham [Fri, 8 Dec 2023 12:48:49 +0000 (12:48 +0000)]
Ability to retrieve the thread of a post.

2 years agoFix a wrapping glitch I spotted this morning.
Simon Tatham [Fri, 8 Dec 2023 12:33:24 +0000 (12:33 +0000)]
Fix a wrapping glitch I spotted this morning.

2 years agoFix API mismatch in composer tests.
Simon Tatham [Fri, 8 Dec 2023 12:33:11 +0000 (12:33 +0000)]
Fix API mismatch in composer tests.

2 years agoAdd a final menu before posting a status.
Simon Tatham [Fri, 8 Dec 2023 09:01:11 +0000 (09:01 +0000)]
Add a final menu before posting a status.

So far it doesn't have anything useful in it, but the idea is that it
will be where you add all the other options in statuses, like media
attachments, content warnings, etc.

2 years agoMake the dry-run posting mode a standard option.
Simon Tatham [Fri, 8 Dec 2023 08:55:14 +0000 (08:55 +0000)]
Make the dry-run posting mode a standard option.

It's silly to keep hacking it out in the source code every time I want
to test something!

2 years agoProper old-fashioned [RET][.][RET] to finish a post
Simon Tatham [Fri, 8 Dec 2023 08:42:56 +0000 (08:42 +0000)]
Proper old-fashioned [RET][.][RET] to finish a post

2 years agoImplement extending feeds backwards.
Simon Tatham [Fri, 8 Dec 2023 08:26:03 +0000 (08:26 +0000)]
Implement extending feeds backwards.

2 years agoGet editor limits from the instance.
Simon Tatham [Fri, 8 Dec 2023 07:43:55 +0000 (07:43 +0000)]
Get editor limits from the instance.