simon-git: mastodonochrome (main): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Sat Feb 10 14:47:38 GMT 2024
TL;DR:
84d5576 Fix status-line help for unfolding a post.
3269aa1 Report regex syntax errors via a BottomLineError.
5fa3552 Support Home and End in one-line editors.
45ad4af Allow File to cope when the Client isn't logged in.
3a0a469 Framework for providing online help.
06a9b5d Make a proc-macro sub-crate.
2a8a304 Make key_to_string() public.
b92e4c4 Add a new colour character for bold text.
56377cb Write a proc-macro that consumes help markup.
753690c Write the help!
3766a92 Permit [?] for help everywhere but editors.
2f0eeed Deferred rustfmt update from the previous commit.
Repository: https://git.tartarus.org/simon/mastodonochrome.git
On the web: https://git.tartarus.org/?p=simon/mastodonochrome.git
Branch updated: main
Committer: Simon Tatham <anakin at pobox.com>
Date: 2024-02-10 14:47:38
commit 84d55762dfc2d40412858989eff9c409c0fab5a4
web diff https://git.tartarus.org/?p=simon/mastodonochrome.git;a=commitdiff;h=84d55762dfc2d40412858989eff9c409c0fab5a4;hp=baf01e2bec8112180922af67e7728890f866f931
Author: Simon Tatham <anakin at pobox.com>
Date: Fri Feb 9 18:05:52 2024 +0000
Fix status-line help for unfolding a post.
The keystroke shown in the status line for unfolding (or refolding) is
[U]. But in fact, the keystroke I actually implemented is [SPACE],
just like most other post-selection operations.
src/file.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit 3269aa1c75e435b783b21f0de80da0695342ae29
web diff https://git.tartarus.org/?p=simon/mastodonochrome.git;a=commitdiff;h=3269aa1c75e435b783b21f0de80da0695342ae29;hp=84d55762dfc2d40412858989eff9c409c0fab5a4
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 10 09:54:23 2024 +0000
Report regex syntax errors via a BottomLineError.
This isn't very good so far, because it leaves out the entire actual
error message from the Regex crate. But it's one notch better than
just going beep.
src/file.rs | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
commit 5fa3552462d2040c55ee16d9eeb7971465c51091
web diff https://git.tartarus.org/?p=simon/mastodonochrome.git;a=commitdiff;h=5fa3552462d2040c55ee16d9eeb7971465c51091;hp=3269aa1c75e435b783b21f0de80da0695342ae29
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 10 09:55:05 2024 +0000
Support Home and End in one-line editors.
In the full-screen composer, these are synonyms for [^A] and [^E]. But
they have to be implemented differently in the two editor types, and
somehow I forgot to add the synonyms in the one-line editor type.
src/editor.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
commit 45ad4af9ad88a545a18145f66433cbb06f95f278
web diff https://git.tartarus.org/?p=simon/mastodonochrome.git;a=commitdiff;h=45ad4af9ad88a545a18145f66433cbb06f95f278;hp=5fa3552462d2040c55ee16d9eeb7971465c51091
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 10 11:05:48 2024 +0000
Allow File to cope when the Client isn't logged in.
It was caching our_account_id by calling the Client, but this causes a
panic in pre-login states. Now it calls a new Client function that
returns an Option<String>, and adjusts the checks in the rest of the
implementation accordingly.
This was breaking an attempt to read the server rules (and I hadn't
noticed because the server I most often register with is a standalone
test instance, which doesn't have any). It would also have broken
viewing the online help I'm in the process of writing.
src/client.rs | 4 ++++
src/file.rs | 8 ++++----
2 files changed, 8 insertions(+), 4 deletions(-)
commit 3a0a4695ebc504d3c6202eb7eb6f9f206da2d888
web diff https://git.tartarus.org/?p=simon/mastodonochrome.git;a=commitdiff;h=3a0a4695ebc504d3c6202eb7eb6f9f206da2d888;hp=45ad4af9ad88a545a18145f66433cbb06f95f278
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 10 13:48:38 2024 +0000
Framework for providing online help.
The general idea is that the help keystroke [F1] is available
absolutely everywhere (handled centrally, just like [ESC]), and when
it's pressed, instantiates a Help activity which takes a Box<arbitrary
other activity> as a parameter, so that every activity in the program
can have separately written help.
(Yes, including the help activity itself. There will be help on the
help!)
This complicates the ActivityStack, because help should be available
even in overlay activities. So the stack must contain a new slot for a
'help activity', with higher priority even than an overlay activity.
And because help files will be long pieces of text that you might want
to search, there needs to be space for a help overlay activity on top
of _that_.
Like utility activities, the ActivityStack can only store _one_ help
activity. So if you do ask for help on the help, and then keep
hammering [F1], you don't stack up an endless sequence of identical
activities that then have to be unwound.
This commit fills in the whole framework except for the
help_for_activity() function in the new help.rs, which currently
returns a short fixed file containing "TODO: write the help"
regardless of the activity you asked it about.
src/activity_stack.rs | 100 ++++++++++++++++++++++++++++++++++++++++++++------
src/file.rs | 68 +++++++++++++++++++++++++++++++++-
src/help.rs | 69 ++++++++++++++++++++++++++++++++++
src/main.rs | 1 +
src/tui.rs | 19 ++++++++++
5 files changed, 244 insertions(+), 13 deletions(-)
commit 06a9b5d894958be745d6f1c69e3d75506f1b9cbd
web diff https://git.tartarus.org/?p=simon/mastodonochrome.git;a=commitdiff;h=06a9b5d894958be745d6f1c69e3d75506f1b9cbd;hp=3a0a4695ebc504d3c6202eb7eb6f9f206da2d888
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 10 13:55:39 2024 +0000
Make a proc-macro sub-crate.
Initially, this will contain a macro for making help.rs's HelpVec type
out of some markup that's much easier to write than endless explicit
calls to constructors for Paragraph and ColouredString.
There's nothing in it yet, though. This commit just adds the
sub-crate (in a reasonably concise subdirectory name, but with a
sensible public crate name 'mastodonochrome_macros') and makes it a
dependency of the main crate.
Cargo.lock | 60 ++++++++++++++++------------
Cargo.toml | 1 +
macros/.gitignore | 1 +
macros/.rustfmt.toml | 1 +
macros/Cargo.lock | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++
macros/Cargo.toml | 16 ++++++++
macros/src/lib.rs | 0
7 files changed, 163 insertions(+), 24 deletions(-)
commit 2a8a3045d3c7029819a7824b50cb43e09baac3cd
web diff https://git.tartarus.org/?p=simon/mastodonochrome.git;a=commitdiff;h=2a8a3045d3c7029819a7824b50cb43e09baac3cd;hp=06a9b5d894958be745d6f1c69e3d75506f1b9cbd
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 10 14:00:08 2024 +0000
Make key_to_string() public.
This was previously used only inside text.rs, to format the keystrokes
passed in to things like MenuKeypressLine. But I'm going to want to
call it from help.rs soon, to use the same consistent formatting for
all the keystrokes described in the help.
src/text.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
commit b92e4c421defcc73b1c1b9de408ab3652f204bff
web diff https://git.tartarus.org/?p=simon/mastodonochrome.git;a=commitdiff;h=b92e4c421defcc73b1c1b9de408ab3652f204bff;hp=2a8a3045d3c7029819a7824b50cb43e09baac3cd
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 10 14:00:55 2024 +0000
Add a new colour character for bold text.
It's styled the same as 'k', but is semantically different, because
this is for emphasis, whereas 'k' is for indicating a keystroke. We
should use different letters, in case we want to change the two things
to be styled differently in future.
src/tui.rs | 3 +++
1 file changed, 3 insertions(+)
commit 56377cb191b0e75bb7416a1014c377886b718ebe
web diff https://git.tartarus.org/?p=simon/mastodonochrome.git;a=commitdiff;h=56377cb191b0e75bb7416a1014c377886b718ebe;hp=b92e4c421defcc73b1c1b9de408ab3652f204bff
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 10 14:11:39 2024 +0000
Write a proc-macro that consumes help markup.
This will allow me to write the help in a manner that's more like
writing ordinary text than writing code.
macros/src/iterators.rs | 56 ++++++
macros/src/lib.rs | 77 ++++++++
macros/src/markup.rs | 473 ++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 606 insertions(+)
commit 753690c24b91af194a33452fe4d34c60fde7f32b
web diff https://git.tartarus.org/?p=simon/mastodonochrome.git;a=commitdiff;h=753690c24b91af194a33452fe4d34c60fde7f32b;hp=56377cb191b0e75bb7416a1014c377886b718ebe
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 10 14:14:53 2024 +0000
Write the help!
This fills in a first draft of actual help for every Mastodonochrome
activity. Some pieces of the text are reused across many activities
via subroutines; I _hope_ I've got everything reasonably sensible.
README.md | 8 +-
TODO.md | 6 -
src/help.rs | 1794 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 1789 insertions(+), 19 deletions(-)
commit 3766a9213ab38e2a77a2aebcc2f3b0444d64e885
web diff https://git.tartarus.org/?p=simon/mastodonochrome.git;a=commitdiff;h=3766a9213ab38e2a77a2aebcc2f3b0444d64e885;hp=753690c24b91af194a33452fe4d34c60fde7f32b
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 10 14:28:06 2024 +0000
Permit [?] for help everywhere but editors.
[F1] is the _universal_ help keypress, which I can make work
absolutely anywhere. But real Monochrome uses [?] in most places, with
the necessary exception of text-editing environments where every
printable character must be available to enter into the editor buffer.
I think it's still good to support that, partly because of consistency
with my source material, and also because function keys can be a bit
iffy in terminals if the application and the terminal disagree on what
escape sequences they send. (Indeed, I've never managed to get F1 in
particular to work reliably in ncurses applications, but happily,
ratatui seems to be better at it!)
This commit adds [?] as a help keystroke in all the non-editing
contexts of Mastodonochrome, and advertises it in the status lines
too, so that a user knows they can press it.
The change in the large handle_keypress function in file.rs is going
to cause it to be substantially reindented. To make the patch more
legible, I've made only the semantic change in this commit, and I'll
commit the rustfmt change separately in the next commit.
src/file.rs | 14 ++++++++++----
src/help.rs | 4 ++++
src/login.rs | 9 ++++++---
src/menu.rs | 12 ++++++++----
src/options.rs | 6 ++++++
src/posting.rs | 5 ++++-
6 files changed, 38 insertions(+), 12 deletions(-)
commit 2f0eeede2801fd16ee8612738151a2fd9f854a19
web diff https://git.tartarus.org/?p=simon/mastodonochrome.git;a=commitdiff;h=2f0eeede2801fd16ee8612738151a2fd9f854a19;hp=3766a9213ab38e2a77a2aebcc2f3b0444d64e885
Author: Simon Tatham <anakin at pobox.com>
Date: Sat Feb 10 14:44:34 2024 +0000
Deferred rustfmt update from the previous commit.
src/file.rs | 558 +++++++++++++++++++++++++++++++-----------------------------
1 file changed, 287 insertions(+), 271 deletions(-)
More information about the tartarus-commits
mailing list