Add text mode handling.
This commit is contained in:
@@ -53,6 +53,24 @@ void Function::register_posix(BEd &ctx) {
|
||||
throw fatal_error("Quitting", 0);
|
||||
}
|
||||
};
|
||||
ctx.functions.insert(
|
||||
"a",
|
||||
Function{
|
||||
.address_kind = Function::AddressKind::Line,
|
||||
.argument_kind = Function::ArgumentKind::None,
|
||||
.input_mode = Function::InputMode::Text,
|
||||
.desc = "Append text to a line.",
|
||||
.default_address = ".",
|
||||
.accept_zero = true,
|
||||
.pre_text_mode = nullptr,
|
||||
.handle = [](BEd &ctx, const buffer::Address &addr_, vase::Shard *text, const Argument &, std::vector<buffer::Line> *) {
|
||||
auto addr = std::get<buffer::Line>(addr_);
|
||||
ctx.buffer(addr.buffername).append(ctx, text, addr.number);
|
||||
ctx.current() = {ctx.prev.buffername, ctx.prev.end};
|
||||
vase::Shard::release(text);
|
||||
}
|
||||
}
|
||||
);
|
||||
ctx.functions.insert(
|
||||
"j",
|
||||
Function{
|
||||
|
||||
Reference in New Issue
Block a user