mirror of
https://github.com/mawww/kakoune.git
synced 2024-10-05 17:18:00 +03:00
Compare commits
32 Commits
6e18812c2c
...
2008cbf367
Author | SHA1 | Date | |
---|---|---|---|
|
2008cbf367 | ||
|
202747e688 | ||
|
d1554b969e | ||
|
193d4ba023 | ||
|
29d0596c71 | ||
|
f4d8a831ff | ||
|
2c923ba827 | ||
|
59ca840a65 | ||
|
64ed046e5a | ||
|
221a538b45 | ||
|
288db58d20 | ||
|
65ac5d42c9 | ||
|
b804693630 | ||
|
449adb14a5 | ||
|
01cb818c20 | ||
|
575f49f1b4 | ||
|
203e3704d8 | ||
|
a553ed5aa1 | ||
|
b7c014ba4f | ||
|
a0a000951e | ||
|
c8f8548130 | ||
|
7a60ae9a7f | ||
|
df80aef04b | ||
|
f25dc419c7 | ||
|
d15208fc19 | ||
|
0fddb3fef8 | ||
|
f2e7498ccc | ||
|
e7605b4ec9 | ||
|
7093f14291 | ||
|
2ab35fbb23 | ||
|
16ace71839 | ||
|
4dd9dbb3f8 |
@ -1,4 +1,4 @@
|
||||
image: freebsd/13.x
|
||||
image: freebsd/latest
|
||||
packages:
|
||||
- gcc
|
||||
tasks:
|
||||
|
@ -15,7 +15,7 @@ Kakoune won't be able to parse named parameters in requests.
|
||||
Here are the data structures used:
|
||||
|
||||
* Color: a string, either a named color, or #rrggbb, or 'default'
|
||||
* Attribute: one of {underline, reverse, blink, bold, dim, italic, final_fg, final_bg, final_attr}
|
||||
* Attribute: one of {underline, curly_underline, double_underline, reverse, blink, bold, dim, italic, final_fg, final_bg, final_attr}
|
||||
* Face { Color fg; Color bg; Array<Attribute> attributes; }
|
||||
* Atom { Face face; String contents; }
|
||||
* Line : Array of Atom
|
||||
@ -58,7 +58,8 @@ The requests that the json ui can interpret on stdin are:
|
||||
|
||||
* keys(String key1, String key2...): keystrokes
|
||||
* resize(int rows, int columns): notify ui resize
|
||||
* scroll(int amount): scroll by given line amount
|
||||
* scroll(int amount, int line, int colum): scroll by given line amount, line and
|
||||
column relate to cursor position
|
||||
* mouse_move(int line, int column): line and column relate to the cursor position.
|
||||
* mouse_press(String button, int line, int column): line and column relate to
|
||||
cursor position, button can be 'left', 'middle' or 'right'
|
||||
|
@ -6,6 +6,7 @@ released versions.
|
||||
== Development version
|
||||
|
||||
* Expose env vars that are mentionned in the arguments passed to shell expansions
|
||||
* Support for colored double underlines
|
||||
|
||||
== Kakoune 2024.05.18
|
||||
|
||||
|
@ -33,6 +33,9 @@ attributes::
|
||||
*c*:::
|
||||
curly underline
|
||||
Note: This takes precedence over underline if both are specified.
|
||||
*U*:::
|
||||
double underline
|
||||
Note: This takes precedence over underline and curly underline if also specified.
|
||||
*r*:::
|
||||
reverse
|
||||
*b*:::
|
||||
|
@ -20,7 +20,6 @@ provide-module eruby %{
|
||||
require-module html
|
||||
add-highlighter shared/eruby regions
|
||||
add-highlighter shared/eruby/html default-region ref html
|
||||
add-highlighter shared/eruby/simple-expression-tag region '<%=' '%>' ref ruby
|
||||
add-highlighter shared/eruby/simple-execution-tag region '<%' '%>' ref ruby
|
||||
add-highlighter shared/eruby/simple-comment-tag region '<%#' '%>' fill comment
|
||||
add-highlighter shared/eruby/simple-execution-tag region (?<=<%) '%>' ref ruby
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "alias_registry.hh"
|
||||
|
||||
#include "command_manager.hh"
|
||||
#include "ranges.hh"
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
48
src/array.hh
Normal file
48
src/array.hh
Normal file
@ -0,0 +1,48 @@
|
||||
#ifndef array_hh_INCLUDED
|
||||
#define array_hh_INCLUDED
|
||||
|
||||
#include <utility>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "array_view.hh"
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct Array
|
||||
{
|
||||
constexpr size_t size() const { return N; }
|
||||
constexpr const T& operator[](int i) const { return m_data[i]; }
|
||||
constexpr const T* begin() const { return m_data; }
|
||||
constexpr const T* end() const { return m_data+N; }
|
||||
|
||||
constexpr T& operator[](int i) { return m_data[i]; }
|
||||
constexpr T* begin() { return m_data; }
|
||||
constexpr T* end() { return m_data+N; }
|
||||
|
||||
constexpr operator ArrayView<T>() { return {m_data, N}; }
|
||||
constexpr operator ConstArrayView<T>() const { return {m_data, N}; }
|
||||
|
||||
T m_data[N];
|
||||
};
|
||||
|
||||
template<typename T, typename... U> requires (std::is_same_v<T, U> and ...)
|
||||
Array(T, U...) -> Array<T, 1 + sizeof...(U)>;
|
||||
|
||||
template<typename T, size_t N, size_t... Indices>
|
||||
constexpr Array<T, N> make_array(const T (&data)[N], std::index_sequence<Indices...>)
|
||||
{
|
||||
static_assert(sizeof...(Indices) == N, "size mismatch");
|
||||
return {{data[Indices]...}};
|
||||
}
|
||||
|
||||
template<typename T, size_t N>
|
||||
constexpr Array<T, N> make_array(const T (&data)[N])
|
||||
{
|
||||
return make_array(data, std::make_index_sequence<N>());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // array_hh_INCLUDED
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "backtrace.hh"
|
||||
|
||||
#include "string.hh"
|
||||
#include "format.hh"
|
||||
|
||||
#if defined(__GLIBC__) || defined(__APPLE__)
|
||||
# include <execinfo.h>
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "clock.hh"
|
||||
#include "coord.hh"
|
||||
#include "constexpr_utils.hh"
|
||||
#include "array.hh"
|
||||
#include "enum.hh"
|
||||
#include "file.hh"
|
||||
#include "optional.hh"
|
||||
|
@ -1,8 +1,6 @@
|
||||
#include "client.hh"
|
||||
|
||||
#include "face_registry.hh"
|
||||
#include "context.hh"
|
||||
#include "buffer_manager.hh"
|
||||
#include "buffer_utils.hh"
|
||||
#include "debug.hh"
|
||||
#include "file.hh"
|
||||
@ -10,8 +8,9 @@
|
||||
#include "option.hh"
|
||||
#include "option_types.hh"
|
||||
#include "client_manager.hh"
|
||||
#include "command_manager.hh"
|
||||
#include "event_manager.hh"
|
||||
#include "shell_manager.hh"
|
||||
#include "command_manager.hh"
|
||||
#include "user_interface.hh"
|
||||
#include "window.hh"
|
||||
#include "hash_map.hh"
|
||||
@ -146,7 +145,8 @@ String generate_context_info(const Context& context)
|
||||
if (context.buffer().is_modified())
|
||||
s += "[+]";
|
||||
if (context.client().input_handler().is_recording())
|
||||
s += format("[recording ({})]", context.client().input_handler().recording_reg());
|
||||
s += format("[recording ({}): {}]", context.client().input_handler().recording_reg(),
|
||||
context.client().input_handler().recorded_keys());
|
||||
if (context.hooks_disabled())
|
||||
s += "[no-hooks]";
|
||||
if (not(context.buffer().flags() & (Buffer::Flags::File | Buffer::Flags::Debug)))
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef client_hh_INCLUDED
|
||||
#define client_hh_INCLUDED
|
||||
|
||||
#include "constexpr_utils.hh"
|
||||
#include "array.hh"
|
||||
#include "display_buffer.hh"
|
||||
#include "env_vars.hh"
|
||||
#include "input_handler.hh"
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include "buffer_manager.hh"
|
||||
#include "command_manager.hh"
|
||||
#include "event_manager.hh"
|
||||
#include "face_registry.hh"
|
||||
#include "file.hh"
|
||||
#include "ranges.hh"
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef command_manager_hh_INCLUDED
|
||||
#define command_manager_hh_INCLUDED
|
||||
|
||||
#include "coord.hh"
|
||||
#include "completion.hh"
|
||||
#include "array_view.hh"
|
||||
#include "shell_manager.hh"
|
||||
@ -12,7 +11,6 @@
|
||||
#include "hash_map.hh"
|
||||
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "user_interface.hh"
|
||||
#include "window.hh"
|
||||
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -2483,8 +2482,9 @@ const CommandDesc set_face_cmd = {
|
||||
" <fg color>[,<bg color>[,<underline color>]][+<attributes>][@<base>]\n"
|
||||
"colors are either a color name, rgb:######, or rgba:######## values.\n"
|
||||
"attributes is a combination of:\n"
|
||||
" u: underline, c: curly underline, i: italic, b: bold,\n"
|
||||
" r: reverse, s: strikethrough, B: blink, d: dim,\n"
|
||||
" u: underline, c: curly underline, U: double underline,\n"
|
||||
" i: italic, b: bold, r: reverse,\n"
|
||||
" s: strikethrough, B: blink, d: dim,\n"
|
||||
" f: final foreground, g: final background,\n"
|
||||
" a: final attributes, F: same as +fga\n"
|
||||
"facespec can as well just be the name of another face.\n"
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef completion_hh_INCLUDED
|
||||
#define completion_hh_INCLUDED
|
||||
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
|
||||
#include "units.hh"
|
||||
|
@ -1,90 +0,0 @@
|
||||
#ifndef constexpr_utils_hh_INCLUDED
|
||||
#define constexpr_utils_hh_INCLUDED
|
||||
|
||||
#include <utility>
|
||||
#include <initializer_list>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "array_view.hh"
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct Array
|
||||
{
|
||||
constexpr size_t size() const { return N; }
|
||||
constexpr const T& operator[](int i) const { return m_data[i]; }
|
||||
constexpr const T* begin() const { return m_data; }
|
||||
constexpr const T* end() const { return m_data+N; }
|
||||
|
||||
constexpr T& operator[](int i) { return m_data[i]; }
|
||||
constexpr T* begin() { return m_data; }
|
||||
constexpr T* end() { return m_data+N; }
|
||||
|
||||
constexpr operator ArrayView<T>() { return {m_data, N}; }
|
||||
constexpr operator ConstArrayView<T>() const { return {m_data, N}; }
|
||||
|
||||
T m_data[N];
|
||||
};
|
||||
|
||||
template<typename T, typename... U> requires (std::is_same_v<T, U> and ...)
|
||||
Array(T, U...) -> Array<T, 1 + sizeof...(U)>;
|
||||
|
||||
template<typename T, size_t N, size_t... Indices>
|
||||
constexpr Array<T, N> make_array(const T (&data)[N], std::index_sequence<Indices...>)
|
||||
{
|
||||
static_assert(sizeof...(Indices) == N, "size mismatch");
|
||||
return {{data[Indices]...}};
|
||||
}
|
||||
|
||||
template<typename T, size_t N>
|
||||
constexpr Array<T, N> make_array(const T (&data)[N])
|
||||
{
|
||||
return make_array(data, std::make_index_sequence<N>());
|
||||
}
|
||||
|
||||
template<typename T, size_t capacity>
|
||||
struct ConstexprVector
|
||||
{
|
||||
using iterator = T*;
|
||||
using const_iterator = const T*;
|
||||
|
||||
constexpr ConstexprVector() : m_size{0} {}
|
||||
constexpr ConstexprVector(std::initializer_list<T> items)
|
||||
: m_size{items.size()}
|
||||
{
|
||||
T* ptr = m_data;
|
||||
for (auto& item : items)
|
||||
*ptr++ = std::move(item);
|
||||
}
|
||||
|
||||
constexpr bool empty() const { return m_size == 0; }
|
||||
constexpr size_t size() const { return m_size; }
|
||||
|
||||
constexpr void resize(size_t n, const T& val = {})
|
||||
{
|
||||
if (n >= capacity)
|
||||
throw "capacity exceeded";
|
||||
for (int i = m_size; i < n; ++i)
|
||||
m_data[i] = val;
|
||||
m_size = n;
|
||||
kak_assert(this->size() == m_size); // check for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79520
|
||||
}
|
||||
|
||||
constexpr T& operator[](size_t i) { return m_data[i]; }
|
||||
constexpr const T& operator[](size_t i) const { return m_data[i]; }
|
||||
|
||||
constexpr iterator begin() { return m_data; }
|
||||
constexpr iterator end() { return m_data + m_size; }
|
||||
|
||||
constexpr const_iterator begin() const { return m_data; }
|
||||
constexpr const_iterator end() const { return m_data + m_size; }
|
||||
|
||||
size_t m_size;
|
||||
T m_data[capacity] = {};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // constexpr_utils_hh_INCLUDED
|
@ -4,7 +4,6 @@
|
||||
#include "selection.hh"
|
||||
#include "optional.hh"
|
||||
#include "utils.hh"
|
||||
#include "flags.hh"
|
||||
|
||||
#include <functional>
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
#ifndef debug_hh_INCLUDED
|
||||
#define debug_hh_INCLUDED
|
||||
|
||||
#include "constexpr_utils.hh"
|
||||
#include "array.hh"
|
||||
#include "enum.hh"
|
||||
#include "flags.hh"
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include "assert.hh"
|
||||
#include "buffer.hh"
|
||||
#include "buffer_utils.hh"
|
||||
#include "face_registry.hh"
|
||||
#include "utf8.hh"
|
||||
|
||||
|
@ -7,9 +7,8 @@
|
||||
#include "string.hh"
|
||||
#include "vector.hh"
|
||||
#include "hash_map.hh"
|
||||
#include "ranges.hh"
|
||||
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
@ -139,7 +138,7 @@ public:
|
||||
template<typename It>
|
||||
iterator insert(iterator pos, It beg, It end)
|
||||
{
|
||||
auto has_buffer_range = std::mem_fn(&DisplayAtom::has_buffer_range);
|
||||
auto has_buffer_range = [](const DisplayAtom& atom) { return atom.has_buffer_range(); };
|
||||
auto had_range = any_of(*this, has_buffer_range);
|
||||
if (auto first = std::find_if(beg, end, has_buffer_range); first != end)
|
||||
{
|
||||
|
27
src/face.hh
27
src/face.hh
@ -9,19 +9,20 @@ namespace Kakoune
|
||||
|
||||
enum class Attribute : int
|
||||
{
|
||||
Normal = 0,
|
||||
Underline = 1 << 1,
|
||||
CurlyUnderline = 1 << 2,
|
||||
Reverse = 1 << 3,
|
||||
Blink = 1 << 4,
|
||||
Bold = 1 << 5,
|
||||
Dim = 1 << 6,
|
||||
Italic = 1 << 7,
|
||||
Strikethrough = 1 << 8,
|
||||
FinalFg = 1 << 9,
|
||||
FinalBg = 1 << 10,
|
||||
FinalAttr = 1 << 11,
|
||||
Final = FinalFg | FinalBg | FinalAttr
|
||||
Normal = 0,
|
||||
Underline = 1 << 1,
|
||||
CurlyUnderline = 1 << 2,
|
||||
DoubleUnderline = 1 << 3,
|
||||
Reverse = 1 << 4,
|
||||
Blink = 1 << 5,
|
||||
Bold = 1 << 6,
|
||||
Dim = 1 << 7,
|
||||
Italic = 1 << 8,
|
||||
Strikethrough = 1 << 9,
|
||||
FinalFg = 1 << 10,
|
||||
FinalBg = 1 << 11,
|
||||
FinalAttr = 1 << 12,
|
||||
Final = FinalFg | FinalBg | FinalAttr
|
||||
};
|
||||
|
||||
constexpr bool with_bit_ops(Meta::Type<Attribute>) { return true; }
|
||||
|
@ -50,6 +50,7 @@ FaceSpec parse_face(StringView facedesc)
|
||||
{
|
||||
case 'u': face.attributes |= Attribute::Underline; break;
|
||||
case 'c': face.attributes |= Attribute::CurlyUnderline; break;
|
||||
case 'U': face.attributes |= Attribute::DoubleUnderline; break;
|
||||
case 'r': face.attributes |= Attribute::Reverse; break;
|
||||
case 'b': face.attributes |= Attribute::Bold; break;
|
||||
case 'B': face.attributes |= Attribute::Blink; break;
|
||||
@ -78,6 +79,7 @@ String to_string(Attribute attributes)
|
||||
attrs[] {
|
||||
{ Attribute::Underline, "u" },
|
||||
{ Attribute::CurlyUnderline, "c" },
|
||||
{ Attribute::DoubleUnderline, "U" },
|
||||
{ Attribute::Reverse, "r" },
|
||||
{ Attribute::Blink, "B" },
|
||||
{ Attribute::Bold, "b" },
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define face_registry_hh_INCLUDED
|
||||
|
||||
#include "face.hh"
|
||||
#include "utils.hh"
|
||||
#include "hash_map.hh"
|
||||
#include "ranges.hh"
|
||||
#include "string.hh"
|
||||
|
@ -4,12 +4,10 @@
|
||||
#include "buffer.hh"
|
||||
#include "exception.hh"
|
||||
#include "flags.hh"
|
||||
#include "option_types.hh"
|
||||
#include "event_manager.hh"
|
||||
#include "ranked_match.hh"
|
||||
#include "regex.hh"
|
||||
#include "string.hh"
|
||||
#include "unicode.hh"
|
||||
|
||||
#include <limits>
|
||||
#include <cerrno>
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "meta.hh"
|
||||
#include "string.hh"
|
||||
#include "units.hh"
|
||||
#include "constexpr_utils.hh"
|
||||
#include "array.hh"
|
||||
#include "vector.hh"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -3,7 +3,9 @@
|
||||
#include "exception.hh"
|
||||
#include "string_utils.hh"
|
||||
|
||||
#include <algorithm>
|
||||
#include <charconv>
|
||||
#include <cstdio>
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "highlighter.hh"
|
||||
|
||||
#include "debug.hh"
|
||||
#include "flags.hh"
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
@ -3,8 +3,6 @@
|
||||
|
||||
#include "coord.hh"
|
||||
#include "completion.hh"
|
||||
#include "exception.hh"
|
||||
#include "flags.hh"
|
||||
#include "range.hh"
|
||||
#include "hash_map.hh"
|
||||
#include "array_view.hh"
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include "highlighter_group.hh"
|
||||
|
||||
#include "ranges.hh"
|
||||
#include "flags.hh"
|
||||
#include "format.hh"
|
||||
#include "ranges.hh"
|
||||
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "changes.hh"
|
||||
#include "command_manager.hh"
|
||||
#include "context.hh"
|
||||
#include "clock.hh"
|
||||
#include "display_buffer.hh"
|
||||
#include "face_registry.hh"
|
||||
#include "highlighter_group.hh"
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "hook_manager.hh"
|
||||
|
||||
#include "debug.hh"
|
||||
#include "clock.hh"
|
||||
#include "command_manager.hh"
|
||||
#include "context.hh"
|
||||
#include "display_buffer.hh"
|
||||
|
@ -1,12 +1,11 @@
|
||||
#ifndef hook_manager_hh_INCLUDED
|
||||
#define hook_manager_hh_INCLUDED
|
||||
|
||||
#include "hash_map.hh"
|
||||
#include "completion.hh"
|
||||
#include "safe_ptr.hh"
|
||||
#include "meta.hh"
|
||||
#include "enum.hh"
|
||||
#include "constexpr_utils.hh"
|
||||
#include "array.hh"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "input_handler.hh"
|
||||
|
||||
#include "buffer_manager.hh"
|
||||
#include "buffer.hh"
|
||||
#include "debug.hh"
|
||||
#include "command_manager.hh"
|
||||
#include "client.hh"
|
||||
@ -11,9 +11,7 @@
|
||||
#include "option_types.hh"
|
||||
#include "regex.hh"
|
||||
#include "register_manager.hh"
|
||||
#include "hash_map.hh"
|
||||
#include "user_interface.hh"
|
||||
#include "utf8.hh"
|
||||
#include "window.hh"
|
||||
#include "word_db.hh"
|
||||
|
||||
@ -118,7 +116,10 @@ struct MouseHandler
|
||||
|
||||
Buffer& buffer = context.buffer();
|
||||
BufferCoord cursor;
|
||||
constexpr auto modifiers = Key::Modifiers::Control | Key::Modifiers::Alt | Key::Modifiers::Shift | Key::Modifiers::MouseButtonMask;
|
||||
// bits above these potentially store additional information
|
||||
constexpr auto mask = (Key::Modifiers) 0x7FF;
|
||||
constexpr auto modifiers = Key::Modifiers::Control | Key::Modifiers::Alt | Key::Modifiers::Shift | Key::Modifiers::MouseButtonMask | ~mask;
|
||||
|
||||
switch ((key.modifiers & ~modifiers).value)
|
||||
{
|
||||
case Key::Modifiers::MousePress:
|
||||
@ -184,7 +185,7 @@ struct MouseHandler
|
||||
}
|
||||
|
||||
case Key::Modifiers::Scroll:
|
||||
scroll_window(context, static_cast<int32_t>(key.key), m_dragging ? OnHiddenCursor::MoveCursor : OnHiddenCursor::PreserveSelections);
|
||||
scroll_window(context, key.scroll_amount(), m_dragging ? OnHiddenCursor::MoveCursor : OnHiddenCursor::PreserveSelections);
|
||||
return true;
|
||||
|
||||
default: return false;
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define input_handler_hh_INCLUDED
|
||||
|
||||
#include "completion.hh"
|
||||
#include "constexpr_utils.hh"
|
||||
#include "array.hh"
|
||||
#include "context.hh"
|
||||
#include "env_vars.hh"
|
||||
#include "enum.hh"
|
||||
@ -100,6 +100,7 @@ public:
|
||||
bool is_recording() const;
|
||||
void stop_recording();
|
||||
char recording_reg() const { return m_recording_reg; }
|
||||
StringView recorded_keys() const { return m_recorded_keys; }
|
||||
|
||||
void reset_normal_mode();
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "utf8_iterator.hh"
|
||||
#include "user_interface.hh"
|
||||
|
||||
#include <numeric>
|
||||
#include <utility>
|
||||
|
||||
namespace Kakoune
|
||||
|
@ -4,7 +4,9 @@
|
||||
#include "string_utils.hh"
|
||||
#include "unit_tests.hh"
|
||||
#include "utils.hh"
|
||||
#include "ranges.hh"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
|
||||
namespace Kakoune
|
||||
|
@ -40,6 +40,7 @@ String to_json(Attribute attributes)
|
||||
attrs[] {
|
||||
{ Attribute::Underline, "underline" },
|
||||
{ Attribute::CurlyUnderline, "curly_underline" },
|
||||
{ Attribute::DoubleUnderline, "double_underline" },
|
||||
{ Attribute::Reverse, "reverse" },
|
||||
{ Attribute::Blink, "blink" },
|
||||
{ Attribute::Bold, "bold" },
|
||||
@ -283,12 +284,12 @@ void JsonUI::eval_json(const Value& json)
|
||||
}
|
||||
else if (method == "scroll")
|
||||
{
|
||||
if (params.size() != 1)
|
||||
throw invalid_rpc_request("scroll needs an amount");
|
||||
else if (not params[0].is_a<int>())
|
||||
throw invalid_rpc_request("scroll amount is not an integer");
|
||||
m_on_key({Key::Modifiers::Scroll, (Codepoint)params[0].as<int>()});
|
||||
|
||||
if (params.size() != 3)
|
||||
throw invalid_rpc_request("scroll needs an amount and coordinates");
|
||||
else if (not params[0].is_a<int>() or not params[1].is_a<int>() or not params[2].is_a<int>())
|
||||
throw invalid_rpc_request("scroll parameters are not integers");
|
||||
m_on_key({Key::Modifiers::Scroll | (Key::Modifiers)(params[0].as<int>() << 16),
|
||||
encode_coord({params[1].as<int>(), params[2].as<int>()})});
|
||||
}
|
||||
else if (method == "menu_select")
|
||||
{
|
||||
|
@ -1,13 +1,10 @@
|
||||
#include "keymap_manager.hh"
|
||||
|
||||
#include "array_view.hh"
|
||||
#include "assert.hh"
|
||||
#include "exception.hh"
|
||||
#include "format.hh"
|
||||
#include "ranges.hh"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
||||
|
@ -1,12 +1,9 @@
|
||||
#ifndef keymap_manager_hh_INCLUDED
|
||||
#define keymap_manager_hh_INCLUDED
|
||||
|
||||
#include "array_view.hh"
|
||||
#include "keys.hh"
|
||||
#include "hash.hh"
|
||||
#include "string.hh"
|
||||
#include "hash_map.hh"
|
||||
#include "utils.hh"
|
||||
#include "vector.hh"
|
||||
|
||||
namespace Kakoune
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "string.hh"
|
||||
#include "unit_tests.hh"
|
||||
#include "utf8_iterator.hh"
|
||||
#include "utils.hh"
|
||||
#include "format.hh"
|
||||
#include "string_utils.hh"
|
||||
|
||||
@ -197,7 +196,7 @@ String to_string(Key key)
|
||||
else if (key.modifiers & Key::Modifiers::MouseRelease)
|
||||
res = format("mouse:release:{}:{}.{}", key.mouse_button(), coord.line, coord.column);
|
||||
else if (key.modifiers & Key::Modifiers::Scroll)
|
||||
res = format("scroll:{}", static_cast<int>(key.key));
|
||||
res = format("scroll:{}:{}.{}", key.scroll_amount(), coord.line, coord.column);
|
||||
else if (key.modifiers & Key::Modifiers::Resize)
|
||||
res = format("resize:{}.{}", coord.line, coord.column);
|
||||
else
|
||||
|
@ -89,8 +89,9 @@ struct Key
|
||||
constexpr bool operator==(Key other) const { return val() == other.val(); }
|
||||
constexpr auto operator<=>(Key other) const { return val() <=> other.val(); }
|
||||
|
||||
constexpr DisplayCoord coord() const { return {(int)((key & 0xFFFF0000) >> 16), (int)(key & 0x0000FFFF)}; }
|
||||
constexpr DisplayCoord coord() const { return {(int)((int32_t) (key & 0xFFFF0000) >> 16), (int)(key & 0x0000FFFF)}; }
|
||||
constexpr MouseButton mouse_button() { return MouseButton{((int)modifiers & (int)Modifiers::MouseButtonMask) >> 6}; }
|
||||
constexpr int scroll_amount() { return (int32_t)modifiers >> 16; }
|
||||
static Modifiers to_modifier(MouseButton button) { return Key::Modifiers{((int)button << 6) & (int)Modifiers::MouseButtonMask}; }
|
||||
|
||||
Optional<Codepoint> codepoint() const;
|
||||
|
20
src/main.cc
20
src/main.cc
@ -28,7 +28,6 @@
|
||||
#include "string.hh"
|
||||
#include "unit_tests.hh"
|
||||
#include "window.hh"
|
||||
#include "clock.hh"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <locale.h>
|
||||
@ -48,6 +47,7 @@ struct {
|
||||
} constexpr version_notes[] = { {
|
||||
0,
|
||||
"» kak_* appearing in shell arguments will be added to the environment\n"
|
||||
"» {+U}double underline{} support\n"
|
||||
}, {
|
||||
20240518,
|
||||
"» Fix tests failing on some platforms\n"
|
||||
@ -829,11 +829,23 @@ int run_server(StringView session, StringView server_init,
|
||||
" {}", error.what()));
|
||||
}
|
||||
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
if (not server_init.empty()) try
|
||||
{
|
||||
Context init_context{Context::EmptyContextFlag{}};
|
||||
command_manager.execute(server_init, init_context);
|
||||
}
|
||||
catch (const kill_session& kill)
|
||||
{
|
||||
Context empty_context{Context::EmptyContextFlag{}};
|
||||
global_scope.hooks().run_hook(Hook::KakEnd, "", empty_context);
|
||||
return kill.exit_status;
|
||||
}
|
||||
catch (runtime_error& error)
|
||||
{
|
||||
startup_error = true;
|
||||
@ -841,12 +853,6 @@ int run_server(StringView session, StringView server_init,
|
||||
" {}", error.what()));
|
||||
}
|
||||
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
if (not files.empty()) try
|
||||
{
|
||||
for (auto& file : files)
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#include <cstddef>
|
||||
#include <new>
|
||||
#include <utility>
|
||||
|
||||
#include "assert.hh"
|
||||
#include "meta.hh"
|
||||
|
@ -4,9 +4,7 @@
|
||||
#include "buffer_manager.hh"
|
||||
#include "buffer_utils.hh"
|
||||
#include "changes.hh"
|
||||
#include "client_manager.hh"
|
||||
#include "command_manager.hh"
|
||||
#include "commands.hh"
|
||||
#include "context.hh"
|
||||
#include "diff.hh"
|
||||
#include "enum.hh"
|
||||
|
@ -1,10 +1,10 @@
|
||||
#ifndef option_hh_INCLUDED
|
||||
#define option_hh_INCLUDED
|
||||
|
||||
#include "enum.hh"
|
||||
#include "exception.hh"
|
||||
#include "meta.hh"
|
||||
#include "string.hh"
|
||||
#include "vector.hh"
|
||||
#include "constexpr_utils.hh"
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
@ -5,8 +5,8 @@
|
||||
#include "exception.hh"
|
||||
#include "hash_map.hh"
|
||||
#include "option.hh"
|
||||
#include "option_types.hh"
|
||||
#include "ranges.hh"
|
||||
#include "utils.hh"
|
||||
#include "vector.hh"
|
||||
#include "format.hh"
|
||||
#include "string_utils.hh"
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "string_utils.hh"
|
||||
#include "format.hh"
|
||||
#include "units.hh"
|
||||
#include "ranges.hh"
|
||||
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "meta.hh"
|
||||
#include "array_view.hh"
|
||||
#include "optional.hh"
|
||||
#include "flags.hh"
|
||||
#include "string.hh"
|
||||
#include "format.hh"
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
#ifndef profile_hh_INCLUDED
|
||||
#define profile_hh_INCLUDED
|
||||
|
||||
#include "option.hh"
|
||||
#include "clock.hh"
|
||||
#include "context.hh"
|
||||
#include "debug.hh"
|
||||
#include "option_manager.hh"
|
||||
|
||||
namespace Kakoune
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef range_hh_INCLUDED
|
||||
#define range_hh_INCLUDED
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
||||
|
@ -5,9 +5,8 @@
|
||||
#include <utility>
|
||||
#include <iterator>
|
||||
#include <numeric>
|
||||
#include <tuple>
|
||||
|
||||
#include "constexpr_utils.hh"
|
||||
#include "array.hh"
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
@ -191,7 +190,13 @@ struct EnumerateView
|
||||
Iterator(size_t index, RangeIt it)
|
||||
: m_index{index}, m_it{std::move(it)} {}
|
||||
|
||||
decltype(auto) operator*() { return std::tuple<size_t, decltype(*m_it)>(m_index, *m_it); }
|
||||
struct ValueType
|
||||
{
|
||||
size_t index;
|
||||
decltype(*std::declval<RangeIt>()) element;
|
||||
};
|
||||
|
||||
ValueType operator*() { return {m_index, *m_it}; }
|
||||
Iterator& operator++() { ++m_index; ++m_it; return *this; }
|
||||
Iterator operator++(int) { auto copy = *this; ++(*this); return copy; }
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
#ifndef ref_ptr_hh_INCLUDED
|
||||
#define ref_ptr_hh_INCLUDED
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
||||
@ -34,7 +32,7 @@ struct RefPtr
|
||||
~RefPtr() noexcept { release(); }
|
||||
RefPtr(const RefPtr& other) : m_ptr(other.m_ptr) { acquire(); }
|
||||
RefPtr(RefPtr&& other)
|
||||
noexcept(noexcept(std::declval<RefPtr>().moved(nullptr)))
|
||||
noexcept(noexcept(moved(nullptr)))
|
||||
: m_ptr(other.m_ptr) { other.m_ptr = nullptr; moved(&other); }
|
||||
|
||||
RefPtr& operator=(const RefPtr& other)
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "regex_impl.hh"
|
||||
|
||||
#include "exception.hh"
|
||||
#include "string.hh"
|
||||
#include "unicode.hh"
|
||||
#include "unit_tests.hh"
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include "buffer_utils.hh"
|
||||
#include "changes.hh"
|
||||
#include "utf8.hh"
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "meta.hh"
|
||||
#include "unicode.hh"
|
||||
#include "vector.hh"
|
||||
#include "constexpr_utils.hh"
|
||||
#include "array.hh"
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "utils.hh"
|
||||
#include "hash_map.hh"
|
||||
|
||||
#include <numeric>
|
||||
#include <cstring>
|
||||
|
||||
namespace Kakoune
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "face_registry.hh"
|
||||
#include "file.hh"
|
||||
#include "flags.hh"
|
||||
#include "option.hh"
|
||||
#include "option_types.hh"
|
||||
#include "regex.hh"
|
||||
|
||||
@ -118,7 +117,7 @@ Shell spawn_shell(const char* shell, StringView cmdline,
|
||||
if (pid_t pid = vfork())
|
||||
return {pid, std::move(stdin_pipe[1]), std::move(stdout_pipe[0]), std::move(stderr_pipe[0])};
|
||||
|
||||
auto renamefd = [](int oldfd, int newfd) {
|
||||
constexpr auto renamefd = [](int oldfd, int newfd) {
|
||||
if (oldfd == newfd)
|
||||
return;
|
||||
dup2(oldfd, newfd);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "units.hh"
|
||||
#include "utf8.hh"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
@ -3,9 +3,7 @@
|
||||
#include "exception.hh"
|
||||
#include "utf8_iterator.hh"
|
||||
#include "unit_tests.hh"
|
||||
|
||||
#include <charconv>
|
||||
#include <cstdio>
|
||||
#include "ranges.hh"
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
@ -188,63 +186,6 @@ String expand_tabs(StringView line, ColumnCount tabstop, ColumnCount col)
|
||||
return res;
|
||||
}
|
||||
|
||||
WrapView::Iterator::Iterator(StringView text, ColumnCount max_width)
|
||||
: m_remaining{text}, m_max_width{max_width}
|
||||
{
|
||||
if (max_width <= 0)
|
||||
throw runtime_error("Invalid max width");
|
||||
++*this;
|
||||
}
|
||||
|
||||
WrapView::Iterator& WrapView::Iterator::operator++()
|
||||
{
|
||||
using Utf8It = utf8::iterator<const char*>;
|
||||
Utf8It it{m_remaining.begin(), m_remaining};
|
||||
Utf8It last_word_end = it;
|
||||
|
||||
while (it != m_remaining.end())
|
||||
{
|
||||
const CharCategories cat = categorize(*it, {'_'});
|
||||
if (cat == CharCategories::EndOfLine)
|
||||
{
|
||||
m_current = StringView{m_remaining.begin(), it.base()};
|
||||
m_remaining = StringView{(it+1).base(), m_remaining.end()};
|
||||
return *this;
|
||||
}
|
||||
|
||||
Utf8It word_end = it+1;
|
||||
while (word_end != m_remaining.end() and categorize(*word_end, {'_'}) == cat)
|
||||
++word_end;
|
||||
|
||||
if (word_end > m_remaining.begin() and
|
||||
utf8::column_distance(m_remaining.begin(), word_end.base()) >= m_max_width)
|
||||
{
|
||||
auto line_end = last_word_end <= m_remaining.begin() ?
|
||||
Utf8It{utf8::advance(m_remaining.begin(), m_remaining.end(), m_max_width), m_remaining}
|
||||
: last_word_end;
|
||||
|
||||
m_current = StringView{m_remaining.begin(), line_end.base()};
|
||||
|
||||
while (line_end != m_remaining.end() and is_horizontal_blank(*line_end))
|
||||
++line_end;
|
||||
|
||||
if (line_end != m_remaining.end() and *line_end == '\n')
|
||||
++line_end;
|
||||
|
||||
m_remaining = StringView{line_end.base(), m_remaining.end()};
|
||||
return *this;
|
||||
}
|
||||
if (cat == CharCategories::Word or cat == CharCategories::Punctuation)
|
||||
last_word_end = word_end;
|
||||
|
||||
if (word_end > m_remaining.begin())
|
||||
it = word_end;
|
||||
}
|
||||
m_current = m_remaining;
|
||||
m_remaining = StringView{};
|
||||
return *this;
|
||||
}
|
||||
|
||||
String double_up(StringView s, StringView characters)
|
||||
{
|
||||
String res;
|
||||
@ -276,21 +217,6 @@ UnitTest test_string{[]()
|
||||
kak_assert(StringView{"youpi"}.ends_with("youpi"));
|
||||
kak_assert(not StringView{"youpi"}.ends_with("oup"));
|
||||
|
||||
auto wrapped = "wrap this paragraph\n respecting whitespaces and much_too_long_words" | wrap_at(16) | gather<Vector<String>>();
|
||||
kak_assert(wrapped.size() == 6);
|
||||
kak_assert(wrapped[0] == "wrap this");
|
||||
kak_assert(wrapped[1] == "paragraph");
|
||||
kak_assert(wrapped[2] == " respecting");
|
||||
kak_assert(wrapped[3] == "whitespaces and");
|
||||
kak_assert(wrapped[4] == "much_too_long_wo");
|
||||
kak_assert(wrapped[5] == "rds");
|
||||
|
||||
auto wrapped2 = "error: unknown type" | wrap_at(7) | gather<Vector<String>>();
|
||||
kak_assert(wrapped2.size() == 3);
|
||||
kak_assert(wrapped2[0] == "error:");
|
||||
kak_assert(wrapped2[1] == "unknown");
|
||||
kak_assert(wrapped2[2] == "type");
|
||||
|
||||
kak_assert(trim_indent(" ") == "");
|
||||
kak_assert(trim_indent("no-indent") == "no-indent");
|
||||
kak_assert(trim_indent("\nno-indent") == "no-indent");
|
||||
|
@ -5,9 +5,8 @@
|
||||
#include "enum.hh"
|
||||
#include "vector.hh"
|
||||
#include "optional.hh"
|
||||
#include "utils.hh"
|
||||
#include "format.hh"
|
||||
#include "ranges.hh"
|
||||
#include "array.hh"
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
@ -67,44 +66,6 @@ bool subsequence_match(StringView str, StringView subseq);
|
||||
|
||||
String expand_tabs(StringView line, ColumnCount tabstop, ColumnCount col = 0);
|
||||
|
||||
struct WrapView
|
||||
{
|
||||
struct Iterator
|
||||
{
|
||||
using difference_type = ptrdiff_t;
|
||||
using value_type = StringView;
|
||||
using pointer = StringView*;
|
||||
using reference = StringView&;
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
|
||||
Iterator(StringView text, ColumnCount max_width);
|
||||
|
||||
Iterator& operator++();
|
||||
Iterator operator++(int) { auto copy = *this; ++(*this); return copy; }
|
||||
|
||||
bool operator==(Iterator other) const { return m_remaining == other.m_remaining and m_current == other.m_current; }
|
||||
StringView operator*() { return m_current; }
|
||||
|
||||
private:
|
||||
StringView m_current;
|
||||
StringView m_remaining;
|
||||
ColumnCount m_max_width;
|
||||
};
|
||||
|
||||
Iterator begin() const { return {text, max_width}; }
|
||||
Iterator end() const { return {{}, 1}; }
|
||||
|
||||
StringView text;
|
||||
ColumnCount max_width;
|
||||
};
|
||||
|
||||
inline auto wrap_at(ColumnCount max_width)
|
||||
{
|
||||
return ViewFactory{[=](StringView text) {
|
||||
return WrapView{text, max_width};
|
||||
}};
|
||||
}
|
||||
|
||||
int str_to_int(StringView str); // throws on error
|
||||
Optional<int> str_to_int_ifp(StringView str);
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "terminal_ui.hh"
|
||||
|
||||
#include "buffer_utils.hh"
|
||||
#include "display_buffer.hh"
|
||||
#include "event_manager.hh"
|
||||
#include "exception.hh"
|
||||
@ -9,6 +8,7 @@
|
||||
#include "ranges.hh"
|
||||
#include "format.hh"
|
||||
#include "diff.hh"
|
||||
#include "string_utils.hh"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@ -224,7 +224,7 @@ void TerminalUI::Screen::set_face(const Face& face, Writer& writer)
|
||||
static constexpr int fg_table[]{ 39, 30, 31, 32, 33, 34, 35, 36, 37, 90, 91, 92, 93, 94, 95, 96, 97 };
|
||||
static constexpr int bg_table[]{ 49, 40, 41, 42, 43, 44, 45, 46, 47, 100, 101, 102, 103, 104, 105, 106, 107 };
|
||||
static constexpr int ul_table[]{ 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
|
||||
static constexpr const char* attr_table[]{ "0", "4", "4:3", "7", "5", "1", "2", "3", "9" };
|
||||
static constexpr const char* attr_table[]{ "0", "4", "4:3", "21", "7", "5", "1", "2", "3", "9" };
|
||||
|
||||
auto set_color = [&](bool fg, const Color& color, bool join) {
|
||||
if (join)
|
||||
@ -703,7 +703,7 @@ Optional<Key> TerminalUI::get_next_key()
|
||||
static constexpr auto control = [](char c) { return c & 037; };
|
||||
|
||||
auto convert = [this](Codepoint c) -> Codepoint {
|
||||
if (c == control('m') or c == control('j'))
|
||||
if (c == control('m'))
|
||||
return Key::Return;
|
||||
if (c == control('i'))
|
||||
return Key::Tab;
|
||||
@ -798,9 +798,8 @@ Optional<Key> TerminalUI::get_next_key()
|
||||
return Key{mod | Key::to_modifier(button), coord};
|
||||
};
|
||||
|
||||
auto mouse_scroll = [this](Key::Modifiers mod, bool down) -> Key {
|
||||
return {mod | Key::Modifiers::Scroll,
|
||||
(Codepoint)((down ? 1 : -1) * m_wheel_scroll_amount)};
|
||||
auto mouse_scroll = [this](Key::Modifiers mod, Codepoint coord, bool down) -> Key {
|
||||
return {mod | Key::Modifiers::Scroll | (Key::Modifiers)((down ? m_wheel_scroll_amount : -1 * m_wheel_scroll_amount) << 16), coord};
|
||||
};
|
||||
|
||||
auto masked_key = [&](Codepoint key, Codepoint shifted_key = 0) {
|
||||
@ -859,6 +858,8 @@ Optional<Key> TerminalUI::get_next_key()
|
||||
return masked_key(Key::F11 + params[0][0] - 23);
|
||||
case 25: case 26:
|
||||
return Key{Key::Modifiers::Shift, Key::F3 + params[0][0] - 25}; // rxvt style
|
||||
case 27:
|
||||
return masked_key(convert(static_cast<Codepoint>(params[2][0])));
|
||||
case 28: case 29:
|
||||
return Key{Key::Modifiers::Shift, Key::F5 + params[0][0] - 28}; // rxvt style
|
||||
case 31: case 32:
|
||||
@ -883,7 +884,23 @@ Optional<Key> TerminalUI::get_next_key()
|
||||
switch (params[0][0])
|
||||
{
|
||||
// Treat numpad keys the same as their non-numpad counterparts. Could add a numpad modifier here.
|
||||
case 57399: key = '0'; break;
|
||||
case 57400: key = '1'; break;
|
||||
case 57401: key = '2'; break;
|
||||
case 57402: key = '3'; break;
|
||||
case 57403: key = '4'; break;
|
||||
case 57404: key = '5'; break;
|
||||
case 57405: key = '6'; break;
|
||||
case 57406: key = '7'; break;
|
||||
case 57407: key = '8'; break;
|
||||
case 57408: key = '9'; break;
|
||||
case 57409: key = '.'; break;
|
||||
case 57410: key = '/'; break;
|
||||
case 57411: key = '*'; break;
|
||||
case 57412: key = '-'; break;
|
||||
case 57413: key = '+'; break;
|
||||
case 57414: key = Key::Return; break;
|
||||
case 57415: key = '='; break;
|
||||
case 57417: key = Key::Left; break;
|
||||
case 57418: key = Key::Right; break;
|
||||
case 57419: key = Key::Up; break;
|
||||
@ -921,8 +938,8 @@ Optional<Key> TerminalUI::get_next_key()
|
||||
else if (int guess = ffs(m_mouse_state) - 1; 0 <= guess and guess < 3)
|
||||
return mouse_button(mod, Key::MouseButton{guess}, coord, true);
|
||||
break;
|
||||
case 64: return mouse_scroll(mod, false);
|
||||
case 65: return mouse_scroll(mod, true);
|
||||
case 64: return mouse_scroll(mod, coord, false);
|
||||
case 65: return mouse_scroll(mod, coord, true);
|
||||
}
|
||||
return Key{Key::Modifiers::MousePos, coord};
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "display_buffer.hh"
|
||||
#include "event_manager.hh"
|
||||
#include "face.hh"
|
||||
#include "hash_map.hh"
|
||||
#include "optional.hh"
|
||||
#include "string.hh"
|
||||
#include "user_interface.hh"
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef fd_hh_INCLUDED
|
||||
#define fd_hh_INCLUDED
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "hash.hh"
|
||||
|
||||
#include <type_traits>
|
||||
#include <compare>
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
@ -6,8 +6,6 @@
|
||||
#include "units.hh"
|
||||
#include "optional.hh"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace Kakoune
|
||||
{
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define value_hh_INCLUDED
|
||||
|
||||
#include "hash_map.hh"
|
||||
#include "units.hh"
|
||||
#include "meta.hh"
|
||||
|
||||
#include <type_traits>
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "assert.hh"
|
||||
#include "buffer.hh"
|
||||
#include "buffer_utils.hh"
|
||||
#include "clock.hh"
|
||||
#include "context.hh"
|
||||
#include "highlighter.hh"
|
||||
#include "hook_manager.hh"
|
||||
|
@ -2,9 +2,7 @@
|
||||
|
||||
#include "buffer.hh"
|
||||
#include "line_modification.hh"
|
||||
#include "option_types.hh"
|
||||
#include "unit_tests.hh"
|
||||
#include "utils.hh"
|
||||
#include "value.hh"
|
||||
|
||||
namespace Kakoune
|
||||
|
@ -1,4 +1,4 @@
|
||||
ui_out -until '{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "black", "bg": "white", "underline": "default", "attributes": [] }, "contents": "0" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "1\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "02\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "03\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "04\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "05\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "06\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "07\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "08\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "09\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "10\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "11\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "12\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "13\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "14\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "15\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "16\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "17\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "18\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "19\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "20\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "21\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "22\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "23\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "24\u000a" }]], { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }] }'
|
||||
ui_out -until '{ "jsonrpc": "2.0", "method": "refresh", "params": [true] }'
|
||||
ui_in '{ "jsonrpc": "2.0", "method": "scroll", "params": [ 2 ] }'
|
||||
ui_in '{ "jsonrpc": "2.0", "method": "scroll", "params": [ 2, 0, 0 ] }'
|
||||
ui_out -until '{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "03\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "04\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "05\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "06\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "07\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "08\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "09\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "10\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "11\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "12\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "13\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "14\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "15\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "16\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "17\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "18\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "19\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "20\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "21\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "22\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "23\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "24\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "25\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "26\u000a" }]], { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }] }'
|
||||
|
@ -4,5 +4,5 @@ ui_out -until-grep menu_show >/dev/null
|
||||
ui_out -until-grep refresh >/dev/null
|
||||
ui_out -until-grep menu_show >/dev/null
|
||||
ui_out -until-grep refresh >/dev/null
|
||||
ui_in '{ "jsonrpc": "2.0", "method": "scroll", "params": [ -5 ] }'
|
||||
ui_in '{ "jsonrpc": "2.0", "method": "scroll", "params": [ -5, 0, 0 ] }'
|
||||
ui_out '{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "1\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "2\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "3\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "4\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "5\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "6\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "7\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "8\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "9\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "10\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "11\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "12\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "13\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "14\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "15\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "16\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "17\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "18\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "19\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "20\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "21\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "22\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "23\u000a" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "24\u000a" }]], { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }] }'
|
||||
|
@ -1,7 +1,5 @@
|
||||
ui_out -ignore 7
|
||||
ui_out -until '{ "jsonrpc": "2.0", "method": "refresh", "params": [true] }'
|
||||
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ ":foo<ret>b" ] }'
|
||||
ui_out -ignore 4
|
||||
ui_out '{ "jsonrpc": "2.0", "method": "refresh", "params": [false] }'
|
||||
ui_out -ignore 3
|
||||
ui_out '{ "jsonrpc": "2.0", "method": "menu_show", "params": [[[{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "bar" }]], { "line": 0, "column": 0 }, { "fg": "white", "bg": "blue", "underline": "default", "attributes": [] }, { "fg": "blue", "bg": "white", "underline": "default", "attributes": [] }, "prompt"] }'
|
||||
ui_out -until '{ "jsonrpc": "2.0", "method": "refresh", "params": [false] }'
|
||||
ui_out -until '{ "jsonrpc": "2.0", "method": "menu_show", "params": [[[{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "bar" }]], { "line": 0, "column": 0 }, { "fg": "white", "bg": "blue", "underline": "default", "attributes": [] }, { "fg": "blue", "bg": "white", "underline": "default", "attributes": [] }, "prompt"] }'
|
||||
ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "<tab><ret>" ] }'
|
||||
|
Loading…
Reference in New Issue
Block a user