mirror of
https://github.com/mawww/kakoune.git
synced 2024-08-16 16:20:38 +03:00
Compare commits
15 Commits
504adf6294
...
4b04f666f7
Author | SHA1 | Date | |
---|---|---|---|
|
4b04f666f7 | ||
|
e0bbd1e7ca | ||
|
8ca7b5815a | ||
|
80fcfebca8 | ||
|
cbdd200e73 | ||
|
0a10612786 | ||
|
07000adb9b | ||
|
374a7a8c99 | ||
|
6674fe7587 | ||
|
4a00a6edea | ||
|
6493ddad42 | ||
|
880ad98a30 | ||
|
0bb355557e | ||
|
1bd5637b56 | ||
|
eb5db3f0fd |
@ -455,8 +455,8 @@ using the built-in `:doc` command.
|
|||||||
| Q | chunk interactively, and replay the sequence of keys
|
| Q | chunk interactively, and replay the sequence of keys
|
||||||
`---' at will. The sequence in question is a macro: the `Q`
|
`---' at will. The sequence in question is a macro: the `Q`
|
||||||
primitive will create a new one (i.e., record all the keys
|
primitive will create a new one (i.e., record all the keys
|
||||||
.---, .---, hit henceforth until the escape key `<esc>` is hit), and
|
.---, .---, hit henceforth until `Q` is hit again), and the `q`
|
||||||
|ctl|+| r |_. the `q` primitive will replay the keys saved in the macro.
|
|ctl|+| r |_. primitive will replay the keys saved in the macro.
|
||||||
`---' `---' `.---,
|
`---' `---' `.---,
|
||||||
| @ | Notes: macros can easily be translated into a proper
|
| @ | Notes: macros can easily be translated into a proper
|
||||||
`---' script, as they are saved in the `@` register, which you
|
`---' script, as they are saved in the `@` register, which you
|
||||||
|
@ -41,22 +41,27 @@ highlighter is replaced with the new one.
|
|||||||
using the `Whitespace` face, with the following *options*:
|
using the `Whitespace` face, with the following *options*:
|
||||||
|
|
||||||
*-lf* <separator>:::
|
*-lf* <separator>:::
|
||||||
a one character long separator that will replace line feeds
|
a one character long separator that will replace line feeds,
|
||||||
|
or an empty string to ignore them.
|
||||||
|
|
||||||
*-spc* <separator>:::
|
*-spc* <separator>:::
|
||||||
a one character long separator that will replace spaces
|
a one character long separator that will replace spaces,
|
||||||
|
or an empty string to ignore them.
|
||||||
|
|
||||||
*-nbsp* <separator>:::
|
*-nbsp* <separator>:::
|
||||||
a one character long separator that will replace non-breakable spaces
|
a one character long separator that will replace non-breakable spaces,
|
||||||
|
or an empty string to ignore them.
|
||||||
|
|
||||||
*-tab* <separator>:::
|
*-tab* <separator>:::
|
||||||
a one character long separator that will replace tabulations
|
a one character long separator that will replace tabulations,
|
||||||
|
or an empty string to ignore them.
|
||||||
|
|
||||||
*-tabpad* <separator>:::
|
*-tabpad* <separator>:::
|
||||||
a one character long separator that will be appended to tabulations to honor the *tabstop* option
|
a one character long separator that will be appended to tabulations to honor the *tabstop* option
|
||||||
|
|
||||||
*-indent* <separator>:::
|
*-indent* <separator>:::
|
||||||
a one character long separator that will replace the first space in indentation according to the *indentwidth* option
|
a one character long separator that will replace the first space in indentation
|
||||||
|
according to the *indentwidth* option, or an empty string to ignore them.
|
||||||
This will use the `WhitespaceIndent` face.
|
This will use the `WhitespaceIndent` face.
|
||||||
|
|
||||||
*-only-trailing*:::
|
*-only-trailing*:::
|
||||||
|
@ -147,6 +147,11 @@ name. Hooks with no description will always use an empty string.
|
|||||||
*SessionRenamed* `<old name>:<new name>`::
|
*SessionRenamed* `<old name>:<new name>`::
|
||||||
executed when a session is renamed using the `rename-session` command
|
executed when a session is renamed using the `rename-session` command
|
||||||
|
|
||||||
|
*EnterDirectory* `path`::
|
||||||
|
executed on startup and when the current working directory is changed
|
||||||
|
using the `change-directory` command. The hook param is an absolute path
|
||||||
|
to the new working directory.
|
||||||
|
|
||||||
*RuntimeError* `error message`::
|
*RuntimeError* `error message`::
|
||||||
an error was encountered while executing a user command
|
an error was encountered while executing a user command
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ hook global BufCreate .*[.](ex|exs) %{
|
|||||||
set-option buffer filetype elixir
|
set-option buffer filetype elixir
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufCreate .*[.]html[.]l?eex %{
|
hook global BufCreate .*[.]html[.][lh]?eex %{
|
||||||
set-option buffer filetype eex
|
set-option buffer filetype eex
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,6 +64,7 @@ add-highlighter shared/elixir/single_string region "'" "(?<!\\)(?:\\\\)*'" fill
|
|||||||
add-highlighter shared/elixir/comment region '#' '$' fill comment
|
add-highlighter shared/elixir/comment region '#' '$' fill comment
|
||||||
|
|
||||||
add-highlighter shared/elixir/leex region -match-capture '~L("""|")' '(?<!\\)(?:\\\\)*("""|")' ref eex
|
add-highlighter shared/elixir/leex region -match-capture '~L("""|")' '(?<!\\)(?:\\\\)*("""|")' ref eex
|
||||||
|
add-highlighter shared/elixir/heex region -match-capture '~H("""|")' '(?<!\\)(?:\\\\)*("""|")' ref eex
|
||||||
|
|
||||||
add-highlighter shared/elixir/double_string/base default-region fill string
|
add-highlighter shared/elixir/double_string/base default-region fill string
|
||||||
add-highlighter shared/elixir/double_string/interpolation region -recurse \{ \Q#{ \} fill builtin
|
add-highlighter shared/elixir/double_string/interpolation region -recurse \{ \Q#{ \} fill builtin
|
||||||
|
@ -75,7 +75,7 @@ hook global BufSetOption filetype=(html|xml) %{
|
|||||||
set-option buffer comment_block_end '-->'
|
set-option buffer comment_block_end '-->'
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufSetOption filetype=(latex|mercury) %{
|
hook global BufSetOption filetype=(erlang|latex|mercury) %{
|
||||||
set-option buffer comment_line '%'
|
set-option buffer comment_line '%'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
provide-module fifo %{
|
provide-module fifo %{
|
||||||
|
|
||||||
define-command -params .. -docstring %{
|
define-command -params .. -docstring %{
|
||||||
fifo [-name <buffer-name>] [-scroll] [--] <command>...: run command in a fifo buffer
|
fifo [-name <name>] [-scroll] [-script <script>] [--] <args>...: run command in a fifo buffer
|
||||||
|
if <script> is used, eval it with <args> as '$@', else pass arguments directly to the shell
|
||||||
} fifo %{ evaluate-commands %sh{
|
} fifo %{ evaluate-commands %sh{
|
||||||
name='*fifo*'
|
name='*fifo*'
|
||||||
while true; do
|
while true; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"-scroll") scroll="-scroll"; shift ;;
|
"-scroll") scroll="-scroll"; shift ;;
|
||||||
|
"-script") script="$2"; shift 2 ;;
|
||||||
"-name") name="$2"; shift 2 ;;
|
"-name") name="$2"; shift 2 ;;
|
||||||
"--") shift; break ;;
|
"--") shift; break ;;
|
||||||
*) break ;;
|
*) break ;;
|
||||||
@ -14,7 +16,11 @@ define-command -params .. -docstring %{
|
|||||||
done
|
done
|
||||||
output=$(mktemp -d "${TMPDIR:-/tmp}"/kak-fifo.XXXXXXXX)/fifo
|
output=$(mktemp -d "${TMPDIR:-/tmp}"/kak-fifo.XXXXXXXX)/fifo
|
||||||
mkfifo ${output}
|
mkfifo ${output}
|
||||||
( eval "$@" > ${output} 2>&1 & ) > /dev/null 2>&1 < /dev/null
|
if [ -n "$script" ]; then
|
||||||
|
( eval "$script" > ${output} 2>&1 & ) > /dev/null 2>&1 < /dev/null
|
||||||
|
else
|
||||||
|
( "$@" > ${output} 2>&1 & ) > /dev/null 2>&1 < /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
printf %s\\n "
|
printf %s\\n "
|
||||||
edit! -fifo ${output} ${scroll} ${name}
|
edit! -fifo ${output} ${scroll} ${name}
|
||||||
|
@ -12,8 +12,7 @@ define-command -params .. -docstring %{
|
|||||||
Passing no argument will perform a literal-string grep for the current selection
|
Passing no argument will perform a literal-string grep for the current selection
|
||||||
} grep %{
|
} grep %{
|
||||||
evaluate-commands -try-client %opt{toolsclient} %{
|
evaluate-commands -try-client %opt{toolsclient} %{
|
||||||
fifo -name *grep* %{
|
fifo -name *grep* -script %{
|
||||||
shift 2
|
|
||||||
trap - INT QUIT
|
trap - INT QUIT
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
case "$kak_opt_grepcmd" in
|
case "$kak_opt_grepcmd" in
|
||||||
@ -29,7 +28,7 @@ define-command -params .. -docstring %{
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
$kak_opt_grepcmd "$@" 2>&1 | tr -d '\r'
|
$kak_opt_grepcmd "$@" 2>&1 | tr -d '\r'
|
||||||
} 'exit;' %arg{@} # pass arguments for "$@" above, exit to avoid evaluating them
|
} -- %arg{@}
|
||||||
set-option buffer filetype grep
|
set-option buffer filetype grep
|
||||||
set-option buffer jump_current_line 0
|
set-option buffer jump_current_line 0
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,10 @@ define-command -params .. -docstring %{
|
|||||||
All the optional arguments are forwarded to the make utility
|
All the optional arguments are forwarded to the make utility
|
||||||
} make %{
|
} make %{
|
||||||
evaluate-commands -try-client %opt{toolsclient} %{
|
evaluate-commands -try-client %opt{toolsclient} %{
|
||||||
fifo -scroll -name *make* %{
|
fifo -scroll -name *make* -script %{
|
||||||
shift 2
|
|
||||||
trap - INT QUIT
|
trap - INT QUIT
|
||||||
$kak_opt_makecmd "$@"
|
$kak_opt_makecmd "$@"
|
||||||
} 'exit;' %arg{@} # pass arguments for "$@" above, exit to avoid evaluating them
|
} -- %arg{@}
|
||||||
set-option buffer filetype make
|
set-option buffer filetype make
|
||||||
set-option buffer jump_current_line 0
|
set-option buffer jump_current_line 0
|
||||||
}
|
}
|
||||||
|
@ -2600,13 +2600,15 @@ const CommandDesc change_directory_cmd = {
|
|||||||
cursor_pos, FilenameFlags::OnlyDirectories),
|
cursor_pos, FilenameFlags::OnlyDirectories),
|
||||||
Completions::Flags::Menu };
|
Completions::Flags::Menu };
|
||||||
}),
|
}),
|
||||||
[](const ParametersParser& parser, Context&, const ShellContext&)
|
[](const ParametersParser& parser, Context& ctx, const ShellContext&)
|
||||||
{
|
{
|
||||||
StringView target = parser.positional_count() == 1 ? StringView{parser[0]} : "~";
|
StringView target = parser.positional_count() == 1 ? StringView{parser[0]} : "~";
|
||||||
if (chdir(parse_filename(target).c_str()) != 0)
|
auto path = real_path(parse_filename(target));
|
||||||
|
if (chdir(path.c_str()) != 0)
|
||||||
throw runtime_error(format("unable to change to directory: '{}'", target));
|
throw runtime_error(format("unable to change to directory: '{}'", target));
|
||||||
for (auto& buffer : BufferManager::instance())
|
for (auto& buffer : BufferManager::instance())
|
||||||
buffer->update_display_name();
|
buffer->update_display_name();
|
||||||
|
ctx.hooks().run_hook(Hook::EnterDirectory, path, ctx);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ StringView Context::main_sel_register_value(StringView reg) const
|
|||||||
return RegisterManager::instance()[reg].get_main(*this, index);
|
return RegisterManager::instance()[reg].get_main(*this, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Context::set_name(String name) {
|
void Context::set_name(String name) {
|
||||||
String old_name = std::exchange(m_name, std::move(name));
|
String old_name = std::exchange(m_name, std::move(name));
|
||||||
hooks().run_hook(Hook::ClientRenamed, format("{}:{}", old_name, m_name), *this);
|
hooks().run_hook(Hook::ClientRenamed, format("{}:{}", old_name, m_name), *this);
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ struct HashMap
|
|||||||
constexpr bool contains(const KeyType& key) const { return find_index(key) >= 0; }
|
constexpr bool contains(const KeyType& key) const { return find_index(key) >= 0; }
|
||||||
|
|
||||||
template<typename KeyType> requires IsHashCompatible<Key, std::remove_cvref_t<KeyType>>
|
template<typename KeyType> requires IsHashCompatible<Key, std::remove_cvref_t<KeyType>>
|
||||||
constexpr EffectiveValue& operator[](KeyType&& key)
|
constexpr EffectiveValue& operator[](KeyType&& key)
|
||||||
{
|
{
|
||||||
const auto hash = hash_value(key);
|
const auto hash = hash_value(key);
|
||||||
auto index = find_index(key, hash);
|
auto index = find_index(key, hash);
|
||||||
|
@ -981,18 +981,14 @@ struct ShowWhitespacesHighlighter : Highlighter
|
|||||||
bool only_trailing = (bool) parser.get_switch("only-trailing");
|
bool only_trailing = (bool) parser.get_switch("only-trailing");
|
||||||
auto get_param = [&](StringView param, StringView fallback) {
|
auto get_param = [&](StringView param, StringView fallback) {
|
||||||
StringView value = parser.get_switch(param).value_or(fallback);
|
StringView value = parser.get_switch(param).value_or(fallback);
|
||||||
if (value.char_length() != 1)
|
if (value.char_length() > 1)
|
||||||
throw runtime_error{format("-{} expects a single character parameter", param)};
|
throw runtime_error{format("-{} expects a single character or empty parameter", param)};
|
||||||
return value.str();
|
return value.str();
|
||||||
};
|
};
|
||||||
|
|
||||||
String indent = parser.get_switch("indent").value_or("│").str();
|
|
||||||
if (indent.char_length() > 1)
|
|
||||||
throw runtime_error{format("-indent expects a single character or empty parameter")};
|
|
||||||
|
|
||||||
return std::make_unique<ShowWhitespacesHighlighter>(
|
return std::make_unique<ShowWhitespacesHighlighter>(
|
||||||
get_param("tab", "→"), get_param("tabpad", " "), get_param("spc", "·"),
|
get_param("tab", "→"), get_param("tabpad", " "), get_param("spc", "·"),
|
||||||
get_param("lf", "¬"), get_param("nbsp", "⍽"), indent, only_trailing);
|
get_param("lf", "¬"), get_param("nbsp", "⍽"), get_param("indent", "│"), only_trailing);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -1043,28 +1039,28 @@ private:
|
|||||||
if (it != end)
|
if (it != end)
|
||||||
atom_it = line.split(atom_it, it.coord());
|
atom_it = line.split(atom_it, it.coord());
|
||||||
|
|
||||||
if (cp == '\t')
|
if (cp == '\t' and not m_tab.empty() and not m_tabpad.empty())
|
||||||
{
|
{
|
||||||
const ColumnCount column = get_column(buffer, tabstop, coord);
|
const ColumnCount column = get_column(buffer, tabstop, coord);
|
||||||
const ColumnCount count = tabstop - (column % tabstop);
|
const ColumnCount count = tabstop - (column % tabstop);
|
||||||
atom_it->replace(m_tab + String(m_tabpad[(CharCount)0], count - m_tab.column_length()));
|
atom_it->replace(m_tab + String(m_tabpad[(CharCount)0], count - m_tab.column_length()));
|
||||||
}
|
}
|
||||||
else if (cp == ' ') {
|
else if (cp == ' ' and is_indentation and indentwidth > 0 and not m_indent.empty()) {
|
||||||
if (m_indent.empty() or indentwidth == 0 or not is_indentation) {
|
const ColumnCount column = get_column(buffer, tabstop, coord);
|
||||||
|
if (column % indentwidth == 0 and column != 0) {
|
||||||
|
atom_it->replace(m_indent);
|
||||||
|
face = indentface;
|
||||||
|
}
|
||||||
|
else {
|
||||||
atom_it->replace(m_spc);
|
atom_it->replace(m_spc);
|
||||||
} else {
|
|
||||||
const ColumnCount column = get_column(buffer, tabstop, coord);
|
|
||||||
if (column % indentwidth == 0 and column != 0) {
|
|
||||||
atom_it->replace(m_indent);
|
|
||||||
face = indentface;
|
|
||||||
} else {
|
|
||||||
atom_it->replace(m_spc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (cp == '\n')
|
else if (cp == ' ' and not m_spc.empty()) {
|
||||||
|
atom_it->replace(m_spc);
|
||||||
|
}
|
||||||
|
else if (cp == '\n' and not m_lf.empty())
|
||||||
atom_it->replace(m_lf);
|
atom_it->replace(m_lf);
|
||||||
else if (cp == 0xA0 or cp == 0x202F)
|
else if ((cp == 0xA0 or cp == 0x202F) and not m_nbsp.empty())
|
||||||
atom_it->replace(m_nbsp);
|
atom_it->replace(m_nbsp);
|
||||||
atom_it->face = merge_faces(atom_it->face, face);
|
atom_it->face = merge_faces(atom_it->face, face);
|
||||||
break;
|
break;
|
||||||
|
@ -50,6 +50,7 @@ enum class Hook
|
|||||||
NextKeyIdle,
|
NextKeyIdle,
|
||||||
NormalKey,
|
NormalKey,
|
||||||
ModeChange,
|
ModeChange,
|
||||||
|
EnterDirectory,
|
||||||
RawKey,
|
RawKey,
|
||||||
RegisterModified,
|
RegisterModified,
|
||||||
WinClose,
|
WinClose,
|
||||||
@ -97,6 +98,7 @@ constexpr auto enum_desc(Meta::Type<Hook>)
|
|||||||
{Hook::NextKeyIdle, "NextKeyIdle"},
|
{Hook::NextKeyIdle, "NextKeyIdle"},
|
||||||
{Hook::NormalKey, "NormalKey"},
|
{Hook::NormalKey, "NormalKey"},
|
||||||
{Hook::ModeChange, "ModeChange"},
|
{Hook::ModeChange, "ModeChange"},
|
||||||
|
{Hook::EnterDirectory, "EnterDirectory"},
|
||||||
{Hook::RawKey, "RawKey"},
|
{Hook::RawKey, "RawKey"},
|
||||||
{Hook::RegisterModified, "RegisterModified"},
|
{Hook::RegisterModified, "RegisterModified"},
|
||||||
{Hook::WinClose, "WinClose"},
|
{Hook::WinClose, "WinClose"},
|
||||||
|
@ -842,6 +842,7 @@ int run_server(StringView session, StringView server_init,
|
|||||||
|
|
||||||
{
|
{
|
||||||
Context empty_context{Context::EmptyContextFlag{}};
|
Context empty_context{Context::EmptyContextFlag{}};
|
||||||
|
global_scope.hooks().run_hook(Hook::EnterDirectory, real_path("."), empty_context);
|
||||||
global_scope.hooks().run_hook(Hook::KakBegin, session, empty_context);
|
global_scope.hooks().run_hook(Hook::KakBegin, session, empty_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,13 +589,13 @@ void pipe(Context& context, NormalParams params)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Buffer& buffer = context.buffer();
|
Buffer& buffer = context.buffer();
|
||||||
SelectionList selections = context.selections();
|
|
||||||
if (replace)
|
if (replace)
|
||||||
{
|
{
|
||||||
|
buffer.throw_if_read_only();
|
||||||
ScopedEdition edition(context);
|
ScopedEdition edition(context);
|
||||||
ForwardChangesTracker changes_tracker;
|
ForwardChangesTracker changes_tracker;
|
||||||
size_t timestamp = buffer.timestamp();
|
size_t timestamp = buffer.timestamp();
|
||||||
Vector<Selection> new_sels;
|
SelectionList selections = context.selections();
|
||||||
for (auto& sel : selections)
|
for (auto& sel : selections)
|
||||||
{
|
{
|
||||||
const auto beg = changes_tracker.get_new_coord_tolerant(sel.min());
|
const auto beg = changes_tracker.get_new_coord_tolerant(sel.min());
|
||||||
@ -614,20 +614,27 @@ void pipe(Context& context, NormalParams params)
|
|||||||
|
|
||||||
auto new_end = apply_diff(buffer, beg, in, out);
|
auto new_end = apply_diff(buffer, beg, in, out);
|
||||||
if (new_end != beg)
|
if (new_end != beg)
|
||||||
new_sels.push_back(keep_direction({beg, buffer.char_prev(new_end), std::move(sel.captures())}, sel));
|
{
|
||||||
|
auto& min = sel.min();
|
||||||
|
auto& max = sel.max();
|
||||||
|
min = beg;
|
||||||
|
max = buffer.char_prev(new_end);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (new_end != BufferCoord{})
|
if (new_end != BufferCoord{})
|
||||||
new_end = buffer.char_prev(new_end);
|
new_end = buffer.char_prev(new_end);
|
||||||
new_sels.push_back({new_end, new_end, std::move(sel.captures())});
|
sel.set(new_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
changes_tracker.update(buffer, timestamp);
|
changes_tracker.update(buffer, timestamp);
|
||||||
}
|
}
|
||||||
context.selections_write_only().set(std::move(new_sels), selections.main_index());
|
selections.force_timestamp(timestamp);
|
||||||
|
context.selections_write_only() = std::move(selections);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
SelectionList& selections = context.selections();
|
||||||
const auto old_main = selections.main_index();
|
const auto old_main = selections.main_index();
|
||||||
for (int i = 0; i < selections.size(); ++i)
|
for (int i = 0; i < selections.size(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -753,7 +753,10 @@ private:
|
|||||||
{
|
{
|
||||||
auto node = compile_node<direction>(child);
|
auto node = compile_node<direction>(child);
|
||||||
if (child != index+1)
|
if (child != index+1)
|
||||||
m_program.instructions[--split_pos].param.split = CompiledRegex::Param::Split{.offset = offset(node, split_pos), .prioritize_parent = true};
|
{
|
||||||
|
--split_pos;
|
||||||
|
m_program.instructions[split_pos].param.split = {.offset = offset(node, split_pos), .prioritize_parent = true};
|
||||||
|
}
|
||||||
if (get_node(child).children_end != end)
|
if (get_node(child).children_end != end)
|
||||||
{
|
{
|
||||||
auto jump = push_inst(CompiledRegex::Jump);
|
auto jump = push_inst(CompiledRegex::Jump);
|
||||||
|
@ -40,7 +40,7 @@ void HistoryRegister::set(Context& context, ConstArrayView<String> values, bool
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto&& entry : values | reverse())
|
for (auto&& entry : values | reverse())
|
||||||
{
|
{
|
||||||
m_content.erase(std::remove(m_content.begin(), m_content.end(), entry), m_content.end());
|
m_content.erase(std::remove(m_content.begin(), m_content.end(), entry), m_content.end());
|
||||||
m_content.insert(m_content.begin(), entry);
|
m_content.insert(m_content.begin(), entry);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
namespace Kakoune
|
namespace Kakoune
|
||||||
{
|
{
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
// Avoid including all of <algorithm> just for this.
|
// Avoid including all of <algorithm> just for this.
|
||||||
constexpr auto max(auto lhs, auto rhs) { return lhs > rhs ? lhs : rhs;}
|
constexpr auto max(auto lhs, auto rhs) { return lhs > rhs ? lhs : rhs;}
|
||||||
@ -69,7 +69,7 @@ void String::Data::reserve(size_t new_capacity)
|
|||||||
if (current_capacity != 0 and new_capacity <= current_capacity)
|
if (current_capacity != 0 and new_capacity <= current_capacity)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!is_long() and new_capacity <= Short::capacity)
|
if (!is_long() and new_capacity <= Short::capacity)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
kak_assert(new_capacity <= Long::max_capacity);
|
kak_assert(new_capacity <= Long::max_capacity);
|
||||||
|
@ -169,9 +169,9 @@ public:
|
|||||||
using Alloc = Allocator<char, MemoryDomain::String>;
|
using Alloc = Allocator<char, MemoryDomain::String>;
|
||||||
|
|
||||||
Data() { set_empty(); }
|
Data() { set_empty(); }
|
||||||
Data(NoCopy, const char* data, size_t size) : u{Long{const_cast<char*>(data),
|
Data(NoCopy, const char* data, size_t size) : u{Long{const_cast<char*>(data),
|
||||||
size,
|
size,
|
||||||
/*capacity=*/0,
|
/*capacity=*/0,
|
||||||
/*mode=*/Long::active_mask}} {}
|
/*mode=*/Long::active_mask}} {}
|
||||||
|
|
||||||
Data(const char* data, size_t size, size_t capacity);
|
Data(const char* data, size_t size, size_t capacity);
|
||||||
|
@ -202,7 +202,7 @@ InplaceString<23> to_string(Grouped val)
|
|||||||
InplaceString<23> res;
|
InplaceString<23> res;
|
||||||
for (int pos = 0, len = ungrouped.m_length; pos != len; ++pos)
|
for (int pos = 0, len = ungrouped.m_length; pos != len; ++pos)
|
||||||
{
|
{
|
||||||
if (res.m_length and ((len - pos) % 3) == 0)
|
if (res.m_length and ((len - pos) % 3) == 0)
|
||||||
res.m_data[res.m_length++] = ',';
|
res.m_data[res.m_length++] = ',';
|
||||||
res.m_data[res.m_length++] = ungrouped.m_data[pos];
|
res.m_data[res.m_length++] = ungrouped.m_data[pos];
|
||||||
}
|
}
|
||||||
|
@ -144,10 +144,10 @@ decltype(auto) to_string(const StronglyTypedNumber<RealType, ValueType>& val)
|
|||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
|
|
||||||
template<typename T> requires std::is_convertible_v<T, StringView>
|
template<typename T> requires std::is_convertible_v<T, StringView>
|
||||||
StringView format_param(const T& val) { return val; }
|
StringView format_param(const T& val) { return val; }
|
||||||
|
|
||||||
template<typename T> requires (not std::is_convertible_v<T, StringView>)
|
template<typename T> requires (not std::is_convertible_v<T, StringView>)
|
||||||
decltype(auto) format_param(const T& val) { return to_string(val); }
|
decltype(auto) format_param(const T& val) { return to_string(val); }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -377,7 +377,7 @@ void TerminalUI::Screen::output(bool force, bool synchronized, Writer& writer)
|
|||||||
{
|
{
|
||||||
for (int line = 0; line < (int)size.line; ++line)
|
for (int line = 0; line < (int)size.line; ++line)
|
||||||
{
|
{
|
||||||
auto hash = hash_line(lines[line]);
|
auto hash = hash_line(lines[line]);
|
||||||
if (hash == hashes[line])
|
if (hash == hashes[line])
|
||||||
continue;
|
continue;
|
||||||
hashes[line] = hash;
|
hashes[line] = hash;
|
||||||
|
Loading…
Reference in New Issue
Block a user