diff --git a/src/buffer.cc b/src/buffer.cc index 3114b9f5..d16d53a3 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -123,15 +123,15 @@ bool Buffer::set_name(String name) return false; } -BufferIterator Buffer::iterator_at(BufferCoord coord) const +BufferIterator Buffer::iterator_at(ByteCoord coord) const { return is_end(coord) ? end() : BufferIterator(*this, clamp(coord)); } -BufferCoord Buffer::clamp(BufferCoord coord) const +ByteCoord Buffer::clamp(ByteCoord coord) const { if (m_lines.empty()) - return BufferCoord{}; + return ByteCoord{}; coord.line = Kakoune::clamp(coord.line, 0_line, line_count() - 1); ByteCount max_col = std::max(0_byte, m_lines[coord.line].length() - 1); @@ -139,7 +139,7 @@ BufferCoord Buffer::clamp(BufferCoord coord) const return coord; } -BufferCoord Buffer::offset_coord(BufferCoord coord, CharCount offset) +ByteCoord Buffer::offset_coord(ByteCoord coord, CharCount offset) { auto& line = m_lines[coord.line].content; auto character = std::max(0_char, std::min(line.char_count_to(coord.column) + offset, @@ -147,7 +147,7 @@ BufferCoord Buffer::offset_coord(BufferCoord coord, CharCount offset) return {coord.line, line.byte_count_to(character)}; } -BufferCoord Buffer::offset_coord(BufferCoord coord, LineCount offset) +ByteCoord Buffer::offset_coord(ByteCoord coord, LineCount offset) { auto character = m_lines[coord.line].content.char_count_to(coord.column); auto line = Kakoune::clamp(coord.line + offset, 0_line, line_count()-1); @@ -157,7 +157,7 @@ BufferCoord Buffer::offset_coord(BufferCoord coord, LineCount offset) return {line, content.byte_count_to(character)}; } -String Buffer::string(BufferCoord begin, BufferCoord end) const +String Buffer::string(ByteCoord begin, ByteCoord end) const { String res; for (auto line = begin.line; line <= end.line and line < line_count(); ++line) @@ -179,10 +179,10 @@ struct Buffer::Modification enum Type { Insert, Erase }; Type type; - BufferCoord coord; + ByteCoord coord; String content; - Modification(Type type, BufferCoord coord, String content) + Modification(Type type, ByteCoord coord, String content) : type(type), coord(coord), content(std::move(content)) {} Modification inverse() const @@ -203,7 +203,7 @@ class UndoGroupOptimizer static constexpr auto Insert = Buffer::Modification::Type::Insert; static constexpr auto Erase = Buffer::Modification::Type::Erase; - static BufferCoord advance(BufferCoord coord, const String& str) + static ByteCoord advance(ByteCoord coord, const String& str) { for (auto c : str) { @@ -218,7 +218,7 @@ class UndoGroupOptimizer return coord; } - static ByteCount count_byte_to(BufferCoord pos, BufferCoord endpos, const String& str) + static ByteCount count_byte_to(ByteCoord pos, ByteCoord endpos, const String& str) { ByteCount count = 0; for (auto it = str.begin(); it != str.end() and pos != endpos; ++it) @@ -270,7 +270,7 @@ class UndoGroupOptimizer // so we have a O(n²) worst case complexity of the undo group optimization if (next_coord < coord) { - BufferCoord next_end = advance(next_coord, it_next->content); + ByteCoord next_end = advance(next_coord, it_next->content); if (it_next->type == Insert) { if (coord.line == next_coord.line) @@ -448,7 +448,7 @@ void Buffer::check_invariant() const #endif } -BufferCoord Buffer::do_insert(BufferCoord pos, const String& content) +ByteCoord Buffer::do_insert(ByteCoord pos, const String& content) { kak_assert(is_valid(pos)); @@ -462,8 +462,8 @@ BufferCoord Buffer::do_insert(BufferCoord pos, const String& content) for (LineCount i = pos.line+1; i < line_count(); ++i) m_lines[i].start += content.length(); - BufferCoord begin; - BufferCoord end; + ByteCoord begin; + ByteCoord end; // if we inserted at the end of the buffer, we have created a new // line without inserting a '\n' if (is_end(pos)) @@ -480,8 +480,8 @@ BufferCoord Buffer::do_insert(BufferCoord pos, const String& content) if (start != content.length()) m_lines.push_back({ m_timestamp, offset + start, content.substr(start) }); - begin = pos.column == 0 ? pos : BufferCoord{ pos.line + 1, 0 }; - end = BufferCoord{ line_count()-1, m_lines.back().length() }; + begin = pos.column == 0 ? pos : ByteCoord{ pos.line + 1, 0 }; + end = ByteCoord{ line_count()-1, m_lines.back().length() }; } else { @@ -521,7 +521,7 @@ BufferCoord Buffer::do_insert(BufferCoord pos, const String& content) std::make_move_iterator(new_lines.end())); begin = pos; - end = BufferCoord{ last_line, m_lines[last_line].length() - suffix.length() }; + end = ByteCoord{ last_line, m_lines[last_line].length() - suffix.length() }; } for (auto listener : m_change_listeners) @@ -529,7 +529,7 @@ BufferCoord Buffer::do_insert(BufferCoord pos, const String& content) return begin; } -BufferCoord Buffer::do_erase(BufferCoord begin, BufferCoord end) +ByteCoord Buffer::do_erase(ByteCoord begin, ByteCoord end) { kak_assert(is_valid(begin)); kak_assert(is_valid(end)); @@ -539,7 +539,7 @@ BufferCoord Buffer::do_erase(BufferCoord begin, BufferCoord end) String suffix = m_lines[end.line].content.substr(end.column); Line new_line = { m_timestamp, m_lines[begin.line].start, prefix + suffix }; - BufferCoord next; + ByteCoord next; if (new_line.length() != 0) { m_lines.erase(m_lines.begin() + (int)begin.line, m_lines.begin() + (int)end.line); @@ -549,7 +549,7 @@ BufferCoord Buffer::do_erase(BufferCoord begin, BufferCoord end) else { m_lines.erase(m_lines.begin() + (int)begin.line, m_lines.begin() + (int)end.line + 1); - next = is_end(begin) ? end_coord() : BufferCoord{begin.line, 0}; + next = is_end(begin) ? end_coord() : ByteCoord{begin.line, 0}; } for (LineCount i = begin.line+1; i < line_count(); ++i) @@ -563,11 +563,11 @@ BufferCoord Buffer::do_erase(BufferCoord begin, BufferCoord end) void Buffer::apply_modification(const Modification& modification) { const String& content = modification.content; - BufferCoord coord = modification.coord; + ByteCoord coord = modification.coord; kak_assert(is_valid(coord)); // in modifications, end coords should be {line_count(), 0} - kak_assert(coord != BufferCoord(line_count()-1, m_lines.back().length())); + kak_assert(coord != ByteCoord(line_count()-1, m_lines.back().length())); switch (modification.type) { case Modification::Insert: @@ -578,7 +578,7 @@ void Buffer::apply_modification(const Modification& modification) case Modification::Erase: { ByteCount count = content.length(); - BufferCoord end = advance(coord, count); + ByteCoord end = advance(coord, count); kak_assert(string(coord, end) == content); do_erase(coord, end); break; @@ -599,7 +599,7 @@ BufferIterator Buffer::insert(const BufferIterator& pos, String content) // for undo and redo purpose it is better to use one past last line rather // than one past last char coord. - auto coord = pos == end() ? BufferCoord{line_count()} : pos.coord(); + auto coord = pos == end() ? ByteCoord{line_count()} : pos.coord(); if (not (m_flags & Flags::NoUndo)) m_current_undo_group.emplace_back(Modification::Insert, coord, content); return {*this, do_insert(pos.coord(), content)}; @@ -642,7 +642,7 @@ void Buffer::notify_saved() m_fs_timestamp = get_fs_timestamp(m_name); } -BufferCoord Buffer::advance(BufferCoord coord, ByteCount count) const +ByteCoord Buffer::advance(ByteCoord coord, ByteCount count) const { ByteCount off = Kakoune::clamp(offset(coord) + count, 0_byte, byte_count()); auto it = std::upper_bound(m_lines.begin(), m_lines.end(), off, @@ -650,7 +650,7 @@ BufferCoord Buffer::advance(BufferCoord coord, ByteCount count) const return { LineCount{ (int)(it - m_lines.begin()) }, off - it->start }; } -BufferCoord Buffer::char_next(BufferCoord coord) const +ByteCoord Buffer::char_next(ByteCoord coord) const { if (coord.column < m_lines[coord.line].length() - 1) { @@ -673,7 +673,7 @@ BufferCoord Buffer::char_next(BufferCoord coord) const return coord; } -BufferCoord Buffer::char_prev(BufferCoord coord) const +ByteCoord Buffer::char_prev(ByteCoord coord) const { kak_assert(is_valid(coord)); if (is_end(coord)) @@ -715,7 +715,7 @@ void Buffer::run_hook_in_own_context(const String& hook_name, const String& para m_hooks.run_hook(hook_name, param, hook_handler.context()); } -BufferCoord Buffer::last_modification_coord() const +ByteCoord Buffer::last_modification_coord() const { if (m_history.empty()) return {}; diff --git a/src/buffer.hh b/src/buffer.hh index 36da3786..ece9fedb 100644 --- a/src/buffer.hh +++ b/src/buffer.hh @@ -1,7 +1,7 @@ #ifndef buffer_hh_INCLUDED #define buffer_hh_INCLUDED -#include "line_and_column.hh" +#include "coord.hh" #include "hook_manager.hh" #include "option_manager.hh" #include "keymap_manager.hh" @@ -20,12 +20,6 @@ class Buffer; constexpr time_t InvalidTime = 0; -struct BufferCoord : LineAndColumn -{ - constexpr BufferCoord(LineCount line = 0, ByteCount column = 0) - : LineAndColumn(line, column) {} -}; - // A BufferIterator permits to iterate over the characters of a buffer class BufferIterator { @@ -37,7 +31,7 @@ public: using iterator_category = std::random_access_iterator_tag; BufferIterator() : m_buffer(nullptr) {} - BufferIterator(const Buffer& buffer, BufferCoord coord); + BufferIterator(const Buffer& buffer, ByteCoord coord); bool operator== (const BufferIterator& iterator) const; bool operator!= (const BufferIterator& iterator) const; @@ -62,20 +56,20 @@ public: BufferIterator operator++ (int); BufferIterator operator-- (int); - const BufferCoord& coord() const { return m_coord; } + const ByteCoord& coord() const { return m_coord; } private: safe_ptr m_buffer; - BufferCoord m_coord; + ByteCoord m_coord; }; class BufferChangeListener { public: virtual void on_insert(const Buffer& buffer, - BufferCoord begin, BufferCoord end) = 0; + ByteCoord begin, ByteCoord end) = 0; virtual void on_erase(const Buffer& buffer, - BufferCoord begin, BufferCoord end) = 0; + ByteCoord begin, ByteCoord end) = 0; }; // A Buffer is a in-memory representation of a file @@ -118,25 +112,25 @@ public: bool undo(); bool redo(); - String string(BufferCoord begin, BufferCoord end) const; + String string(ByteCoord begin, ByteCoord end) const; - char byte_at(BufferCoord c) const; - ByteCount offset(BufferCoord c) const; - ByteCount distance(BufferCoord begin, BufferCoord end) const; - BufferCoord advance(BufferCoord coord, ByteCount count) const; - BufferCoord next(BufferCoord coord) const; - BufferCoord prev(BufferCoord coord) const; + char byte_at(ByteCoord c) const; + ByteCount offset(ByteCoord c) const; + ByteCount distance(ByteCoord begin, ByteCoord end) const; + ByteCoord advance(ByteCoord coord, ByteCount count) const; + ByteCoord next(ByteCoord coord) const; + ByteCoord prev(ByteCoord coord) const; - BufferCoord char_next(BufferCoord coord) const; - BufferCoord char_prev(BufferCoord coord) const; + ByteCoord char_next(ByteCoord coord) const; + ByteCoord char_prev(ByteCoord coord) const; - BufferCoord back_coord() const; - BufferCoord end_coord() const; + ByteCoord back_coord() const; + ByteCoord end_coord() const; - bool is_valid(BufferCoord c) const; - bool is_end(BufferCoord c) const; + bool is_valid(ByteCoord c) const; + bool is_end(ByteCoord c) const; - BufferCoord last_modification_coord() const; + ByteCoord last_modification_coord() const; BufferIterator begin() const; BufferIterator end() const; @@ -147,13 +141,13 @@ public: { return m_lines[line].content; } // returns an iterator at given coordinates. clamp line_and_column - BufferIterator iterator_at(BufferCoord coord) const; + BufferIterator iterator_at(ByteCoord coord) const; // returns nearest valid coordinates from given ones - BufferCoord clamp(BufferCoord coord) const; + ByteCoord clamp(ByteCoord coord) const; - BufferCoord offset_coord(BufferCoord coord, CharCount offset); - BufferCoord offset_coord(BufferCoord coord, LineCount offset); + ByteCoord offset_coord(ByteCoord coord, CharCount offset); + ByteCoord offset_coord(ByteCoord coord, LineCount offset); const String& name() const { return m_name; } String display_name() const; @@ -203,8 +197,8 @@ private: }; LineList m_lines; - BufferCoord do_insert(BufferCoord pos, const String& content); - BufferCoord do_erase(BufferCoord begin, BufferCoord end); + ByteCoord do_insert(ByteCoord pos, const String& content); + ByteCoord do_erase(ByteCoord begin, ByteCoord end); String m_name; Flags m_flags; diff --git a/src/buffer.inl.hh b/src/buffer.inl.hh index 78a965b0..1920857d 100644 --- a/src/buffer.inl.hh +++ b/src/buffer.inl.hh @@ -6,13 +6,13 @@ namespace Kakoune { -inline char Buffer::byte_at(BufferCoord c) const +inline char Buffer::byte_at(ByteCoord c) const { kak_assert(c.line < line_count() and c.column < m_lines[c.line].length()); return m_lines[c.line].content[c.column]; } -inline BufferCoord Buffer::next(BufferCoord coord) const +inline ByteCoord Buffer::next(ByteCoord coord) const { if (coord.column < m_lines[coord.line].length() - 1) ++coord.column; @@ -26,7 +26,7 @@ inline BufferCoord Buffer::next(BufferCoord coord) const return coord; } -inline BufferCoord Buffer::prev(BufferCoord coord) const +inline ByteCoord Buffer::prev(ByteCoord coord) const { if (coord.column == 0) { @@ -38,28 +38,28 @@ inline BufferCoord Buffer::prev(BufferCoord coord) const return coord; } -inline ByteCount Buffer::distance(BufferCoord begin, BufferCoord end) const +inline ByteCount Buffer::distance(ByteCoord begin, ByteCoord end) const { return offset(end) - offset(begin); } -inline ByteCount Buffer::offset(BufferCoord c) const +inline ByteCount Buffer::offset(ByteCoord c) const { if (c.line == line_count()) return m_lines.back().start + m_lines.back().length(); return m_lines[c.line].start + c.column; } -inline bool Buffer::is_valid(BufferCoord c) const +inline bool Buffer::is_valid(ByteCoord c) const { return (c.line < line_count() and c.column < m_lines[c.line].length()) or (c.line == line_count() - 1 and c.column == m_lines.back().length()) or (c.line == line_count() and c.column == 0); } -inline bool Buffer::is_end(BufferCoord c) const +inline bool Buffer::is_end(ByteCoord c) const { - return c >= BufferCoord{line_count() - 1, m_lines.back().length()}; + return c >= ByteCoord{line_count() - 1, m_lines.back().length()}; } inline BufferIterator Buffer::begin() const @@ -96,17 +96,17 @@ inline size_t Buffer::line_timestamp(LineCount line) const return m_lines[line].timestamp; } -inline BufferCoord Buffer::back_coord() const +inline ByteCoord Buffer::back_coord() const { return { line_count() - 1, m_lines.back().length() - 1 }; } -inline BufferCoord Buffer::end_coord() const +inline ByteCoord Buffer::end_coord() const { return { line_count() - 1, m_lines.back().length() }; } -inline BufferIterator::BufferIterator(const Buffer& buffer, BufferCoord coord) +inline BufferIterator::BufferIterator(const Buffer& buffer, ByteCoord coord) : m_buffer(&buffer), m_coord(coord) { kak_assert(m_buffer and m_buffer->is_valid(m_coord)); diff --git a/src/buffer_utils.cc b/src/buffer_utils.cc index 1ed1a836..9f5892c2 100644 --- a/src/buffer_utils.cc +++ b/src/buffer_utils.cc @@ -6,7 +6,7 @@ namespace Kakoune { CharCount get_column(const Buffer& buffer, - CharCount tabstop, BufferCoord coord) + CharCount tabstop, ByteCoord coord) { auto& line = buffer[coord.line]; auto col = 0_char; diff --git a/src/buffer_utils.hh b/src/buffer_utils.hh index ba295821..bd617595 100644 --- a/src/buffer_utils.hh +++ b/src/buffer_utils.hh @@ -24,7 +24,7 @@ inline CharCount char_length(const Buffer& buffer, const Selection& range) utf8::next(buffer.iterator_at(range.max()))); } -inline void avoid_eol(const Buffer& buffer, BufferCoord& coord) +inline void avoid_eol(const Buffer& buffer, ByteCoord& coord) { const auto column = coord.column; const auto& line = buffer[coord.line]; @@ -39,7 +39,7 @@ inline void avoid_eol(const Buffer& buffer, Selection& sel) } CharCount get_column(const Buffer& buffer, - CharCount tabstop, BufferCoord coord); + CharCount tabstop, ByteCoord coord); Buffer* create_fifo_buffer(String name, int fd, bool scroll = false); diff --git a/src/client.cc b/src/client.cc index 8abef5ab..5be59b99 100644 --- a/src/client.cc +++ b/src/client.cc @@ -82,8 +82,8 @@ void Client::redraw_ifn() { if (context().window().timestamp() != context().buffer().timestamp()) { - DisplayCoord dimensions = context().ui().dimensions(); - if (dimensions == DisplayCoord{0,0}) + CharCoord dimensions = context().ui().dimensions(); + if (dimensions == CharCoord{0,0}) return; context().window().set_dimensions(dimensions); context().window().update_display_buffer(context()); @@ -96,8 +96,8 @@ void Client::redraw_ifn() static void reload_buffer(Context& context, const String& filename) { - DisplayCoord view_pos = context.window().position(); - BufferCoord cursor_pos = context.selections().main().cursor(); + CharCoord view_pos = context.window().position(); + ByteCoord cursor_pos = context.selections().main().cursor(); Buffer* buf = create_buffer_from_file(filename); if (not buf) return; @@ -121,7 +121,7 @@ void Client::check_buffer_fs_timestamp() return; if (reload == Ask) { - DisplayCoord pos = context().window().dimensions(); + CharCoord pos = context().window().dimensions(); pos.column -= 1; m_ui->info_show( "reload '" + buffer.display_name() + "' ?", diff --git a/src/commands.cc b/src/commands.cc index fbed8daa..8b3e6de8 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -1150,7 +1150,7 @@ const CommandDesc info_cmd = { if (parser.positional_count() > 0) { MenuStyle style = MenuStyle::Prompt; - DisplayCoord pos = context.ui().dimensions(); + CharCoord pos = context.ui().dimensions(); pos.column -= 1; if (parser.has_option("anchor")) { diff --git a/src/line_and_column.hh b/src/coord.hh similarity index 80% rename from src/line_and_column.hh rename to src/coord.hh index 27ed61f0..daa8bee0 100644 --- a/src/line_and_column.hh +++ b/src/coord.hh @@ -1,5 +1,7 @@ -#ifndef line_and_column_hh_INCLUDED -#define line_and_column_hh_INCLUDED +#ifndef coord_hh_INCLUDED +#define coord_hh_INCLUDED + +#include "units.hh" namespace Kakoune { @@ -72,6 +74,18 @@ struct LineAndColumn } }; +struct ByteCoord : LineAndColumn +{ + constexpr ByteCoord(LineCount line = 0, ByteCount column = 0) + : LineAndColumn(line, column) {} +}; + +struct CharCoord : LineAndColumn +{ + constexpr CharCoord(LineCount line = 0, CharCount column = 0) + : LineAndColumn(line, column) {} +}; + } -#endif // line_and_column_hh_INCLUDED +#endif // coord_hh_INCLUDED diff --git a/src/display_buffer.cc b/src/display_buffer.cc index d49e1a13..2c705bdb 100644 --- a/src/display_buffer.cc +++ b/src/display_buffer.cc @@ -42,7 +42,7 @@ DisplayLine::DisplayLine(AtomList atoms) compute_range(); } -DisplayLine::iterator DisplayLine::split(iterator it, BufferCoord pos) +DisplayLine::iterator DisplayLine::split(iterator it, ByteCoord pos) { kak_assert(it->type() == DisplayAtom::BufferRange); kak_assert(it->begin() < pos); diff --git a/src/display_buffer.hh b/src/display_buffer.hh index b992654a..50b1c92a 100644 --- a/src/display_buffer.hh +++ b/src/display_buffer.hh @@ -3,7 +3,7 @@ #include "buffer.hh" #include "color.hh" -#include "line_and_column.hh" +#include "coord.hh" #include "string.hh" #include "utf8.hh" @@ -12,12 +12,6 @@ namespace Kakoune { -struct DisplayCoord : LineAndColumn -{ - constexpr DisplayCoord(LineCount line = 0, CharCount column = 0) - : LineAndColumn(line, column) {} -}; - using Attribute = char; enum Attributes @@ -34,7 +28,7 @@ struct DisplayAtom public: enum Type { BufferRange, ReplacedBufferRange, Text }; - DisplayAtom(const Buffer& buffer, BufferCoord begin, BufferCoord end) + DisplayAtom(const Buffer& buffer, ByteCoord begin, ByteCoord end) : m_type(BufferRange), m_buffer(&buffer), m_begin(begin), m_end(end) { check_invariant(); } @@ -72,13 +66,13 @@ public: return 0; } - const BufferCoord& begin() const + const ByteCoord& begin() const { kak_assert(has_buffer_range()); return m_begin; } - const BufferCoord& end() const + const ByteCoord& end() const { kak_assert(has_buffer_range()); return m_end; @@ -114,12 +108,12 @@ private: Type m_type; const Buffer* m_buffer = nullptr; - BufferCoord m_begin; - BufferCoord m_end; + ByteCoord m_begin; + ByteCoord m_end; String m_text; }; -using BufferRange = std::pair; +using BufferRange = std::pair; using AtomList = std::vector; class DisplayLine @@ -146,7 +140,7 @@ public: const BufferRange& range() const { return m_range; } // Split atom pointed by it at pos, returns an iterator to the first atom - iterator split(iterator it, BufferCoord pos); + iterator split(iterator it, ByteCoord pos); iterator insert(iterator it, DisplayAtom atom); iterator erase(iterator beg, iterator end); diff --git a/src/dynamic_selection_list.cc b/src/dynamic_selection_list.cc index 921f6147..569d7818 100644 --- a/src/dynamic_selection_list.cc +++ b/src/dynamic_selection_list.cc @@ -36,12 +36,12 @@ void DynamicSelectionList::check_invariant() const #endif } -void DynamicSelectionList::on_insert(const Buffer& buffer, BufferCoord begin, BufferCoord end) +void DynamicSelectionList::on_insert(const Buffer& buffer, ByteCoord begin, ByteCoord end) { update_insert(buffer, begin, end); } -void DynamicSelectionList::on_erase(const Buffer& buffer, BufferCoord begin, BufferCoord end) +void DynamicSelectionList::on_erase(const Buffer& buffer, ByteCoord begin, ByteCoord end) { update_erase(buffer, begin, end); } diff --git a/src/dynamic_selection_list.hh b/src/dynamic_selection_list.hh index 54cd2d5b..7da71395 100644 --- a/src/dynamic_selection_list.hh +++ b/src/dynamic_selection_list.hh @@ -19,8 +19,8 @@ public: void check_invariant() const; private: - void on_insert(const Buffer& buffer, BufferCoord begin, BufferCoord end) override; - void on_erase(const Buffer& buffer, BufferCoord begin, BufferCoord end) override; + void on_insert(const Buffer& buffer, ByteCoord begin, ByteCoord end) override; + void on_erase(const Buffer& buffer, ByteCoord begin, ByteCoord end) override; }; } diff --git a/src/highlighters.cc b/src/highlighters.cc index 8c886278..a0a2242a 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -23,7 +23,7 @@ using RegexIterator = boost::regex_iterator; template void highlight_range(DisplayBuffer& display_buffer, - BufferCoord begin, BufferCoord end, + ByteCoord begin, ByteCoord end, bool skip_replaced, T func) { if (begin == end or end <= display_buffer.range().first @@ -66,7 +66,7 @@ template void apply_highlighter(const Context& context, HighlightFlags flags, DisplayBuffer& display_buffer, - BufferCoord begin, BufferCoord end, + ByteCoord begin, ByteCoord end, T&& highlighter) { using LineIterator = DisplayBuffer::LineList::iterator; @@ -197,7 +197,7 @@ private: Cache(const Buffer&){} BufferRange m_range; size_t m_timestamp = 0; - std::vector>> m_matches; + std::vector>> m_matches; }; BufferSideCache m_cache; @@ -455,8 +455,8 @@ void highlight_selections(const Context& context, HighlightFlags flags, DisplayB { auto& sel = context.selections()[i]; const bool forward = sel.anchor() <= sel.cursor(); - BufferCoord begin = forward ? sel.anchor() : buffer.char_next(sel.cursor()); - BufferCoord end = forward ? sel.cursor() : buffer.char_next(sel.anchor()); + ByteCoord begin = forward ? sel.anchor() : buffer.char_next(sel.cursor()); + ByteCoord end = forward ? sel.cursor() : buffer.char_next(sel.anchor()); const bool primary = (i == context.selections().main_index()); ColorPair sel_colors = get_color(primary ? "PrimarySelection" : "SecondarySelection"); @@ -592,10 +592,10 @@ public: const auto& buffer = context.buffer(); auto& regions = update_cache_ifn(buffer); auto begin = std::lower_bound(regions.begin(), regions.end(), range.first, - [](const Region& r, const BufferCoord& c) { return r.end < c; }); + [](const Region& r, const ByteCoord& c) { return r.end < c; }); auto end = std::lower_bound(begin, regions.end(), range.second, - [](const Region& r, const BufferCoord& c) { return r.begin < c; }); - auto correct = [&](const BufferCoord& c) -> BufferCoord { + [](const Region& r, const ByteCoord& c) { return r.begin < c; }); + auto correct = [&](const ByteCoord& c) -> ByteCoord { if (buffer[c.line].length() == c.column) return {c.line+1, 0}; return c; @@ -611,8 +611,8 @@ private: struct Region { - BufferCoord begin; - BufferCoord end; + ByteCoord begin; + ByteCoord end; }; using RegionList = std::vector; @@ -778,7 +778,7 @@ HighlighterAndId region_factory(HighlighterParameters params) const ColorPair colors = get_color(params[2]); auto func = [colors](const Context&, HighlightFlags flags, DisplayBuffer& display_buffer, - BufferCoord begin, BufferCoord end) + ByteCoord begin, ByteCoord end) { highlight_range(display_buffer, begin, end, true, [&colors](DisplayAtom& atom) { atom.colors = colors; }); @@ -805,7 +805,7 @@ HighlighterAndId region_ref_factory(HighlighterParameters params) const String& name = params[2]; auto func = [name](const Context& context, HighlightFlags flags, DisplayBuffer& display_buffer, - BufferCoord begin, BufferCoord end) + ByteCoord begin, ByteCoord end) { try { diff --git a/src/input_handler.cc b/src/input_handler.cc index b0f3bcc5..f12a8854 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -207,7 +207,7 @@ public: { if (not context().has_ui()) return; - DisplayCoord menu_pos{ context().ui().dimensions().line, 0_char }; + CharCoord menu_pos{ context().ui().dimensions().line, 0_char }; context().ui().menu_show(choices, menu_pos, get_color("MenuForeground"), get_color("MenuBackground"), MenuStyle::Prompt); context().ui().menu_select(0); @@ -549,7 +549,7 @@ private: CandidateList& candidates = m_completions.candidates; if (context().has_ui() and not candidates.empty()) { - DisplayCoord menu_pos{ context().ui().dimensions().line, 0_char }; + CharCoord menu_pos{ context().ui().dimensions().line, 0_char }; context().ui().menu_show(candidates, menu_pos, get_color("MenuForeground"), get_color("MenuBackground"), MenuStyle::Prompt); } @@ -669,7 +669,7 @@ public: { for (auto& sel : context().selections()) { - if (sel.cursor() == BufferCoord{0,0}) + if (sel.cursor() == ByteCoord{0,0}) continue; auto pos = buffer.iterator_at(sel.cursor()); buffer.erase(utf8::previous(pos), pos); @@ -783,7 +783,7 @@ private: for (auto& sel : selections) { - BufferCoord anchor, cursor; + ByteCoord anchor, cursor; switch (mode) { case InsertMode::Insert: @@ -803,7 +803,7 @@ private: case InsertMode::OpenLineBelow: case InsertMode::AppendAtLineEnd: - anchor = cursor = BufferCoord{sel.max().line, buffer[sel.max().line].length() - 1}; + anchor = cursor = ByteCoord{sel.max().line, buffer[sel.max().line].length() - 1}; break; case InsertMode::OpenLineAbove: @@ -841,7 +841,7 @@ private: { // special case, the --first line above did nothing, so we need to compensate now if (sel.anchor() == buffer.char_next({0,0})) - sel.anchor() = sel.cursor() = BufferCoord{0,0}; + sel.anchor() = sel.cursor() = ByteCoord{0,0}; } } } diff --git a/src/insert_completer.cc b/src/insert_completer.cc index 5648bf17..7b7d52fe 100644 --- a/src/insert_completer.cc +++ b/src/insert_completer.cc @@ -29,7 +29,7 @@ WordDB& get_word_db(const Buffer& buffer) } template -InsertCompletion complete_word(const Buffer& buffer, BufferCoord cursor_pos) +InsertCompletion complete_word(const Buffer& buffer, ByteCoord cursor_pos) { auto pos = buffer.iterator_at(cursor_pos); if (pos == buffer.begin() or not is_word(*utf8::previous(pos))) @@ -76,7 +76,7 @@ InsertCompletion complete_word(const Buffer& buffer, BufferCoord cursor_pos) } template -InsertCompletion complete_filename(const Buffer& buffer, BufferCoord cursor_pos, +InsertCompletion complete_filename(const Buffer& buffer, ByteCoord cursor_pos, OptionManager& options) { auto pos = buffer.iterator_at(cursor_pos); @@ -114,7 +114,7 @@ InsertCompletion complete_filename(const Buffer& buffer, BufferCoord cursor_pos, return { begin.coord(), pos.coord(), std::move(res), buffer.timestamp() }; } -InsertCompletion complete_option(const Buffer& buffer, BufferCoord cursor_pos, +InsertCompletion complete_option(const Buffer& buffer, ByteCoord cursor_pos, OptionManager& options, const String& option_name) { const StringList& opt = options[option_name].get();; @@ -126,7 +126,7 @@ InsertCompletion complete_option(const Buffer& buffer, BufferCoord cursor_pos, boost::smatch match; if (boost::regex_match(desc.begin(), desc.end(), match, re)) { - BufferCoord coord{ str_to_int(match[1].str()) - 1, str_to_int(match[2].str()) - 1 }; + ByteCoord coord{ str_to_int(match[1].str()) - 1, str_to_int(match[2].str()) - 1 }; if (not buffer.is_valid(coord)) return {}; auto end = coord; @@ -149,7 +149,7 @@ InsertCompletion complete_option(const Buffer& buffer, BufferCoord cursor_pos, return {}; } -InsertCompletion complete_line(const Buffer& buffer, BufferCoord cursor_pos) +InsertCompletion complete_line(const Buffer& buffer, ByteCoord cursor_pos) { String prefix = buffer[cursor_pos.line].substr(0_byte, cursor_pos.column); StringList res; @@ -223,8 +223,8 @@ void InsertCompleter::update() for (auto& candidate : m_completions.candidates) longest_completion = std::max(longest_completion, candidate.length()); - BufferCoord cursor = m_context.selections().main().cursor(); - BufferCoord compl_beg = m_completions.begin; + ByteCoord cursor = m_context.selections().main().cursor(); + ByteCoord compl_beg = m_completions.begin; if (cursor.line == compl_beg.line and is_in_range(cursor.column - compl_beg.column, ByteCount{0}, longest_completion-1)) @@ -272,24 +272,24 @@ bool InsertCompleter::setup_ifn() for (auto& completer : completers) { if (completer == "filename" and - try_complete([this](const Buffer& buffer, BufferCoord cursor_pos) { + try_complete([this](const Buffer& buffer, ByteCoord cursor_pos) { return complete_filename(buffer, cursor_pos, options()); })) return true; if (completer.substr(0_byte, 7_byte) == "option=" and - try_complete([&,this](const Buffer& buffer, BufferCoord cursor_pos) { + try_complete([&,this](const Buffer& buffer, ByteCoord cursor_pos) { return complete_option(buffer, cursor_pos, options(), completer.substr(7_byte)); })) return true; if (completer == "word=buffer" and - try_complete([this](const Buffer& buffer, BufferCoord cursor_pos) { + try_complete([this](const Buffer& buffer, ByteCoord cursor_pos) { return complete_word(buffer, cursor_pos); })) return true; if (completer == "word=all" and - try_complete([this](const Buffer& buffer, BufferCoord cursor_pos) { + try_complete([this](const Buffer& buffer, ByteCoord cursor_pos) { return complete_word(buffer, cursor_pos); })) return true; @@ -303,7 +303,7 @@ void InsertCompleter::menu_show() { if (not m_context.has_ui()) return; - DisplayCoord menu_pos = m_context.window().display_position(m_completions.begin); + CharCoord menu_pos = m_context.window().display_position(m_completions.begin); const CharCount tabstop = m_context.options()["tabstop"].get(); const CharCount column = get_column(m_context.buffer(), tabstop, @@ -339,7 +339,7 @@ template bool InsertCompleter::try_complete(CompleteFunc complete_func) { auto& buffer = m_context.buffer(); - BufferCoord cursor_pos = m_context.selections().main().cursor(); + ByteCoord cursor_pos = m_context.selections().main().cursor(); try { m_completions = complete_func(buffer, cursor_pos); @@ -362,21 +362,21 @@ bool InsertCompleter::try_complete(CompleteFunc complete_func) void InsertCompleter::explicit_file_complete() { - try_complete([this](const Buffer& buffer, BufferCoord cursor_pos) { + try_complete([this](const Buffer& buffer, ByteCoord cursor_pos) { return complete_filename(buffer, cursor_pos, options()); }); } void InsertCompleter::explicit_word_complete() { - try_complete([this](const Buffer& buffer, BufferCoord cursor_pos) { + try_complete([this](const Buffer& buffer, ByteCoord cursor_pos) { return complete_word(buffer, cursor_pos); }); } void InsertCompleter::explicit_line_complete() { - try_complete([this](const Buffer& buffer, BufferCoord cursor_pos) { + try_complete([this](const Buffer& buffer, ByteCoord cursor_pos) { return complete_line(buffer, cursor_pos); }); } diff --git a/src/insert_completer.hh b/src/insert_completer.hh index d05f8c96..dcbf3ba1 100644 --- a/src/insert_completer.hh +++ b/src/insert_completer.hh @@ -9,10 +9,10 @@ namespace Kakoune struct InsertCompletion { - BufferCoord begin; - BufferCoord end; - CandidateList candidates; - size_t timestamp; + ByteCoord begin; + ByteCoord end; + CandidateList candidates; + size_t timestamp; bool is_valid() const { return not candidates.empty(); } }; diff --git a/src/line_change_watcher.cc b/src/line_change_watcher.cc index af881a69..2e7ba879 100644 --- a/src/line_change_watcher.cc +++ b/src/line_change_watcher.cc @@ -62,7 +62,7 @@ std::vector LineChangeWatcher::compute_modifications() return res; } -void LineChangeWatcher::on_insert(const Buffer& buffer, BufferCoord begin, BufferCoord end) +void LineChangeWatcher::on_insert(const Buffer& buffer, ByteCoord begin, ByteCoord end) { if (buffer.is_end(end)) { @@ -72,7 +72,7 @@ void LineChangeWatcher::on_insert(const Buffer& buffer, BufferCoord begin, Buffe m_changes.push_back({begin.line, end.line - begin.line}); } -void LineChangeWatcher::on_erase(const Buffer& buffer, BufferCoord begin, BufferCoord end) +void LineChangeWatcher::on_erase(const Buffer& buffer, ByteCoord begin, ByteCoord end) { if (begin.line == buffer.line_count()) { diff --git a/src/line_change_watcher.hh b/src/line_change_watcher.hh index 83c90ef3..ce7bedfa 100644 --- a/src/line_change_watcher.hh +++ b/src/line_change_watcher.hh @@ -24,8 +24,8 @@ public: std::vector compute_modifications(); private: - void on_insert(const Buffer& buffer, BufferCoord begin, BufferCoord end) override; - void on_erase(const Buffer& buffer, BufferCoord begin, BufferCoord end) override; + void on_insert(const Buffer& buffer, ByteCoord begin, ByteCoord end) override; + void on_erase(const Buffer& buffer, ByteCoord begin, ByteCoord end) override; struct Change { diff --git a/src/ncurses.cc b/src/ncurses.cc index fc538c1e..a4a84fb5 100644 --- a/src/ncurses.cc +++ b/src/ncurses.cc @@ -210,16 +210,16 @@ void addutf8str(WINDOW* win, Utf8Iterator begin, Utf8Iterator end) waddstr(win, std::string(begin.base(), end.base()).c_str()); } -static DisplayCoord window_size(WINDOW* win) +static CharCoord window_size(WINDOW* win) { - DisplayCoord size; + CharCoord size; getmaxyx(win, (int&)size.line, (int&)size.column); return size; } -static DisplayCoord window_pos(WINDOW* win) +static CharCoord window_pos(WINDOW* win) { - DisplayCoord pos; + CharCoord pos; getbegyx(win, (int&)pos.line, (int&)pos.column); return pos; } @@ -410,7 +410,7 @@ void NCursesUI::draw_menu() const int item_count = (int)m_items.size(); const LineCount menu_lines = div_round_up(item_count, m_menu_columns); - const DisplayCoord win_size = window_size(m_menu_win); + const CharCoord win_size = window_size(m_menu_win); const LineCount& win_height = win_size.line; kak_assert(win_height <= menu_lines); @@ -451,7 +451,7 @@ void NCursesUI::draw_menu() } void NCursesUI::menu_show(memoryview items, - DisplayCoord anchor, ColorPair fg, ColorPair bg, + CharCoord anchor, ColorPair fg, ColorPair bg, MenuStyle style) { if (m_menu_win) @@ -465,7 +465,7 @@ void NCursesUI::menu_show(memoryview items, m_menu_fg = fg; m_menu_bg = bg; - DisplayCoord maxsize = window_size(stdscr); + CharCoord maxsize = window_size(stdscr); maxsize.column -= anchor.column; if (maxsize.column <= 2) return; @@ -532,9 +532,9 @@ void NCursesUI::menu_hide() m_dirty = true; } -static DisplayCoord compute_needed_size(StringView str) +static CharCoord compute_needed_size(StringView str) { - DisplayCoord res{1,0}; + CharCoord res{1,0}; CharCount line_len = 0; for (Utf8Iterator begin{str.begin()}, end{str.end()}; begin != end; ++begin) @@ -558,12 +558,11 @@ static DisplayCoord compute_needed_size(StringView str) return res; } -static DisplayCoord compute_pos(DisplayCoord anchor, - DisplayCoord size, - WINDOW* opt_window_to_avoid = nullptr) +static CharCoord compute_pos(CharCoord anchor, CharCoord size, + WINDOW* opt_window_to_avoid = nullptr) { - DisplayCoord scrsize = window_size(stdscr); - DisplayCoord pos = { anchor.line+1, anchor.column }; + CharCoord scrsize = window_size(stdscr); + CharCoord pos = { anchor.line+1, anchor.column }; if (pos.line + size.line >= scrsize.line) pos.line = max(0_line, anchor.line - size.line); if (pos.column + size.column >= scrsize.column) @@ -571,10 +570,10 @@ static DisplayCoord compute_pos(DisplayCoord anchor, if (opt_window_to_avoid) { - DisplayCoord winbeg = window_pos(opt_window_to_avoid); - DisplayCoord winend = winbeg + window_size(opt_window_to_avoid); + CharCoord winbeg = window_pos(opt_window_to_avoid); + CharCoord winend = winbeg + window_size(opt_window_to_avoid); - DisplayCoord end = pos + size; + CharCoord end = pos + size; // check intersection if (not (end.line < winbeg.line or end.column < winbeg.column or @@ -642,7 +641,7 @@ static String make_info_box(StringView title, StringView message, " │╰─╯│ ", " ╰───╯ ", " " }; - DisplayCoord assistant_size; + CharCoord assistant_size; if (assist) assistant_size = { (int)assistant.size(), assistant[0].char_length() }; @@ -688,7 +687,7 @@ static String make_info_box(StringView title, StringView message, } void NCursesUI::info_show(StringView title, StringView content, - DisplayCoord anchor, ColorPair colors, + CharCoord anchor, ColorPair colors, MenuStyle style) { if (m_info_win) @@ -706,9 +705,9 @@ void NCursesUI::info_show(StringView title, StringView content, info_box = fancy_info_box; } - DisplayCoord size = compute_needed_size(info_box); + CharCoord size = compute_needed_size(info_box); - DisplayCoord pos = compute_pos(anchor, size, m_menu_win); + CharCoord pos = compute_pos(anchor, size, m_menu_win); m_info_win = (NCursesWin*)newwin((int)size.line, (int)size.column, (int)pos.line, (int)pos.column); @@ -739,7 +738,7 @@ void NCursesUI::info_hide() m_dirty = true; } -DisplayCoord NCursesUI::dimensions() +CharCoord NCursesUI::dimensions() { return m_dimensions; } diff --git a/src/ncurses.hh b/src/ncurses.hh index ffbbb81b..1c40c48f 100644 --- a/src/ncurses.hh +++ b/src/ncurses.hh @@ -27,13 +27,13 @@ public: Key get_key() override; void menu_show(memoryview items, - DisplayCoord anchor, ColorPair fg, ColorPair bg, + CharCoord anchor, ColorPair fg, ColorPair bg, MenuStyle style) override; void menu_select(int selected) override; void menu_hide() override; void info_show(StringView title, StringView content, - DisplayCoord anchor, ColorPair colors, + CharCoord anchor, ColorPair colors, MenuStyle style) override; void info_hide() override; @@ -41,7 +41,7 @@ public: void set_input_callback(InputCallback callback) override; - DisplayCoord dimensions() override; + CharCoord dimensions() override; static void abort(); private: @@ -49,7 +49,7 @@ private: void redraw(); void draw_line(const DisplayLine& line, CharCount col_index) const; - DisplayCoord m_dimensions; + CharCoord m_dimensions; void update_dimensions(); NCursesWin* m_menu_win = nullptr; diff --git a/src/normal.cc b/src/normal.cc index d58f5c8c..548e3db4 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -174,7 +174,7 @@ constexpr Select make_select(T func) } template -void select_coord(const Buffer& buffer, BufferCoord coord, SelectionList& selections) +void select_coord(const Buffer& buffer, ByteCoord coord, SelectionList& selections) { coord = buffer.clamp(coord); if (mode == SelectMode::Replace) @@ -204,7 +204,7 @@ bool show_auto_info_ifn(const String& title, const String& info, if (not context.options()["autoinfo"].get() or not context.has_ui()) return false; ColorPair col = get_color("Information"); - DisplayCoord pos = context.window().dimensions(); + CharCoord pos = context.window().dimensions(); pos.column -= 1; context.ui().info_show(title, info, pos , col, MenuStyle::Prompt); return true; @@ -243,7 +243,7 @@ void goto_commands(Context& context, int line) case 'g': case 'k': context.push_jump(); - select_coord(buffer, BufferCoord{0,0}, context.selections()); + select_coord(buffer, ByteCoord{0,0}, context.selections()); break; case 'l': select(context, select_to_eol); @@ -330,7 +330,7 @@ void goto_commands(Context& context, int line) context.push_jump(); auto pos = buffer.last_modification_coord(); if (buffer[pos.line].length() == pos.column + 1) - pos = BufferCoord{ pos.line+1, 0 }; + pos = ByteCoord{ pos.line+1, 0 }; select_coord(buffer, pos, context.selections()); break; } @@ -446,7 +446,7 @@ void command(Context& context, int) { auto info = CommandManager::instance().command_info(cmdline); ColorPair col = get_color("Information"); - DisplayCoord pos = context.window().dimensions(); + CharCoord pos = context.window().dimensions(); pos.column -= 1; if (not info.first.empty() and not info.second.empty()) context.ui().info_show(info.first, info.second, pos , col, MenuStyle::Prompt); @@ -863,12 +863,12 @@ void deindent(Context& context, int) else { if (deindent_incomplete and width != 0) - sels.emplace_back(line, BufferCoord{line, column-1}); + sels.emplace_back(line, ByteCoord{line, column-1}); break; } if (width == indent_width) { - sels.emplace_back(line, BufferCoord{line, column}); + sels.emplace_back(line, ByteCoord{line, column}); break; } } @@ -949,7 +949,7 @@ void scroll(Context& context, int) "scrool only implements PageUp and PageDown"); Window& window = context.window(); Buffer& buffer = context.buffer(); - DisplayCoord position = window.position(); + CharCoord position = window.position(); LineCount cursor_line = 0; if (key == Key::PageUp) @@ -1219,21 +1219,21 @@ public: ModifiedRangesListener(Buffer& buffer) : BufferChangeListener_AutoRegister(buffer) {} - void on_insert(const Buffer& buffer, BufferCoord begin, BufferCoord end) + void on_insert(const Buffer& buffer, ByteCoord begin, ByteCoord end) { m_ranges.update_insert(buffer, begin, end); auto it = std::upper_bound(m_ranges.begin(), m_ranges.end(), begin, - [](BufferCoord c, const Selection& sel) + [](ByteCoord c, const Selection& sel) { return c < sel.min(); }); m_ranges.emplace(it, begin, buffer.char_prev(end)); } - void on_erase(const Buffer& buffer, BufferCoord begin, BufferCoord end) + void on_erase(const Buffer& buffer, ByteCoord begin, ByteCoord end) { m_ranges.update_erase(buffer, begin, end); auto pos = std::min(begin, buffer.back_coord()); auto it = std::upper_bound(m_ranges.begin(), m_ranges.end(), pos, - [](BufferCoord c, const Selection& sel) + [](ByteCoord c, const Selection& sel) { return c < sel.min(); }); m_ranges.emplace(it, pos, pos); } diff --git a/src/remote.cc b/src/remote.cc index 867b281d..cc559871 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -249,13 +249,13 @@ public: ~RemoteUI(); void menu_show(memoryview choices, - DisplayCoord anchor, ColorPair fg, ColorPair bg, + CharCoord anchor, ColorPair fg, ColorPair bg, MenuStyle style) override; void menu_select(int selected) override; void menu_hide() override; void info_show(StringView title, StringView content, - DisplayCoord anchor, ColorPair colors, + CharCoord anchor, ColorPair colors, MenuStyle style) override; void info_hide() override; @@ -267,13 +267,13 @@ public: bool is_key_available() override; Key get_key() override; - DisplayCoord dimensions() override; + CharCoord dimensions() override; void set_input_callback(InputCallback callback) override; private: FDWatcher m_socket_watcher; - DisplayCoord m_dimensions; + CharCoord m_dimensions; InputCallback m_input_callback; }; @@ -296,7 +296,7 @@ RemoteUI::~RemoteUI() } void RemoteUI::menu_show(memoryview choices, - DisplayCoord anchor, ColorPair fg, ColorPair bg, + CharCoord anchor, ColorPair fg, ColorPair bg, MenuStyle style) { Message msg(m_socket_watcher.fd()); @@ -322,7 +322,7 @@ void RemoteUI::menu_hide() } void RemoteUI::info_show(StringView title, StringView content, - DisplayCoord anchor, ColorPair colors, + CharCoord anchor, ColorPair colors, MenuStyle style) { Message msg(m_socket_watcher.fd()); @@ -397,7 +397,7 @@ Key RemoteUI::get_key() } } -DisplayCoord RemoteUI::dimensions() +CharCoord RemoteUI::dimensions() { return m_dimensions; } @@ -447,7 +447,7 @@ void RemoteClient::process_next_message() case RemoteUIMsg::MenuShow: { auto choices = read_vector(socket); - auto anchor = read(socket); + auto anchor = read(socket); auto fg = read(socket); auto bg = read(socket); auto style = read(socket); @@ -464,7 +464,7 @@ void RemoteClient::process_next_message() { auto title = read(socket); auto content = read(socket); - auto anchor = read(socket); + auto anchor = read(socket); auto colors = read(socket); auto style = read(socket); m_ui->info_show(title, content, anchor, colors, style); @@ -494,7 +494,7 @@ void RemoteClient::write_next_key() // handle a resize event. msg.write(m_ui->get_key()); - DisplayCoord dimensions = m_ui->dimensions(); + CharCoord dimensions = m_ui->dimensions(); if (dimensions != m_dimensions) { m_dimensions = dimensions; diff --git a/src/remote.hh b/src/remote.hh index f99b297f..aa2af7b1 100644 --- a/src/remote.hh +++ b/src/remote.hh @@ -32,7 +32,7 @@ private: void write_next_key(); std::unique_ptr m_ui; - DisplayCoord m_dimensions; + CharCoord m_dimensions; FDWatcher m_socket_watcher; }; std::unique_ptr connect_to(const String& session, diff --git a/src/selection.cc b/src/selection.cc index ec4af168..e1627a0c 100644 --- a/src/selection.cc +++ b/src/selection.cc @@ -19,10 +19,10 @@ namespace template