Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

til::rle<T, S> - a run length encoded storage template #8794

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1ed8ef0
copy rectangle to rle and add to sources.
miniksa Jan 8, 2021
00ca3f2
Clean out the rect stuff and prep for rle stuff.
miniksa Jan 8, 2021
8114fa0
it doesn't quite work yet, but it's what I'm going for.
miniksa Jan 9, 2021
33e9a9b
It compiles!
miniksa Jan 11, 2021
f00ffb0
Get some tests going.
miniksa Jan 13, 2021
a692bb2
more rle
miniksa Jan 13, 2021
67d591b
Iterators and tests.
miniksa Jan 14, 2021
a1c1d5c
Make AttrRow use til::rle directly.
miniksa Jan 14, 2021
b591355
Drop attrrowtests.cpp. It overlaps/is obsoleted by RunLengthEncodingT…
miniksa Jan 14, 2021
c65161d
Let full batch assign through to public. Make AttrRow use it. TextAtt…
miniksa Jan 15, 2021
324c094
spell check
miniksa Jan 15, 2021
69538c4
code format
miniksa Jan 15, 2021
9b8c9d4
substring and hide to_string for non-unit-testing.
miniksa Jan 15, 2021
cdc5a6a
Merge branch 'main' into dev/miniksa/rle
miniksa Mar 24, 2021
4247ece
Merge remote-tracking branch 'origin/main' into dev/miniksa/rle
lhecker Apr 28, 2021
b38286c
sprinkled til::rle with my personal preferences
lhecker Apr 28, 2021
bf3edb5
make the linter happy
lhecker Apr 29, 2021
7ad586e
Major rework of til::rle to add replace()
lhecker May 8, 2021
dd1195a
Fix remaining ATTR_ROW + til::rle bugs
lhecker May 8, 2021
e3242b7
Fixed til::rle when inserting more than one run
lhecker May 9, 2021
06d45cc
Initial test coverage work
lhecker May 9, 2021
5878abd
Added til::rle test suite
lhecker May 10, 2021
b05a117
Fix AuditMode errors
lhecker May 11, 2021
9bdcdca
Remove code redundant with consoletaeftemplates.hpp
lhecker May 11, 2021
db0ab1c
Fix til::rle for run length smaller than int
lhecker May 12, 2021
3f1355d
Improved til::rle::replace documentation
lhecker May 14, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/spelling/allow/allow.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Apc
apc
clickable
copyable
dalet
Dcs
dcs
Expand Down
1 change: 1 addition & 0 deletions .github/actions/spelling/expect/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1452,6 +1452,7 @@ mutex
mutexes
muxes
myapplet
mybase
mydir
myignite
MYMAX
Expand Down
565 changes: 30 additions & 535 deletions src/buffer/out/AttrRow.cpp

Large diffs are not rendered by default.

43 changes: 13 additions & 30 deletions src/buffer/out/AttrRow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ Revision History:

#pragma once

#include "TextAttributeRun.hpp"
#include "AttrRowIterator.hpp"
#include "til/rle.h"
#include "TextAttribute.hpp"

class ATTR_ROW final
{
using rle_vector = til::small_rle<TextAttribute, uint16_t, 1>;

public:
using const_iterator = typename AttrRowIterator;
using const_iterator = rle_vector::const_iterator;

ATTR_ROW(const UINT cchRowWidth, const TextAttribute attr)
noexcept;
ATTR_ROW(uint16_t width, TextAttribute attr);

~ATTR_ROW() = default;

Expand All @@ -39,28 +40,13 @@ class ATTR_ROW final
noexcept = default;
ATTR_ROW& operator=(ATTR_ROW&&) noexcept = default;

TextAttribute GetAttrByColumn(const size_t column) const;
TextAttribute GetAttrByColumn(const size_t column,
size_t* const pApplies) const;

size_t GetNumberOfRuns() const noexcept;

size_t FindAttrIndex(const size_t index,
size_t* const pApplies) const;

std::vector<uint16_t> GetHyperlinks();

bool SetAttrToEnd(const UINT iStart, const TextAttribute attr);
void ReplaceAttrs(const TextAttribute& toBeReplacedAttr, const TextAttribute& replaceWith) noexcept;

void Resize(const size_t newWidth);

[[nodiscard]] HRESULT InsertAttrRuns(const gsl::span<const TextAttributeRun> newAttrs,
const size_t iStart,
const size_t iEnd,
const size_t cBufferWidth);
TextAttribute GetAttrByColumn(uint16_t column) const;
std::vector<uint16_t> GetHyperlinks() const;

static std::vector<TextAttributeRun> PackAttrs(const std::vector<TextAttribute>& attrs);
bool SetAttrToEnd(uint16_t beginIndex, TextAttribute attr);
void ReplaceAttrs(const TextAttribute& toBeReplacedAttr, const TextAttribute& replaceWith);
void Resize(uint16_t newWidth);
void Replace(uint16_t beginIndex, uint16_t endIndex, const TextAttribute& newAttr);

const_iterator begin() const noexcept;
const_iterator end() const noexcept;
Expand All @@ -69,17 +55,14 @@ class ATTR_ROW final
const_iterator cend() const noexcept;

friend bool operator==(const ATTR_ROW& a, const ATTR_ROW& b) noexcept;
friend class AttrRowIterator;
friend class ROW;

private:
void Reset(const TextAttribute attr);

boost::container::small_vector<TextAttributeRun, 1> _list;
size_t _cchRowWidth;
rle_vector _data;

#ifdef UNIT_TESTING
friend class AttrRowTests;
friend class CommonState;
#endif
};
136 changes: 0 additions & 136 deletions src/buffer/out/AttrRowIterator.cpp

This file was deleted.

80 changes: 0 additions & 80 deletions src/buffer/out/AttrRowIterator.hpp

This file was deleted.

Loading