PieceTable: newline test from the line index, memchr rebuild; remove dead code
GetLine and LineColToByteOffset fetched each line's last byte (a piece lookup, an allocation and a cache write) to see whether it was a newline; the line index already says so: every line but the last ends at one. LineColToByteOffset runs on every insert. RebuildLineIndex scans with memchr instead of byte by byte. Removed, having no callers: OptimizedSearch (built only into its own test), UndoNodePool.h, SwapManager::RecordSplit/RecordJoin (replay still reads SPLIT/JOIN), PieceTable::Reserve/Capacity and its capacity constructor, Buffer's write-only render column, Editor's mode, no-kill, dirtyex and repeatable flags and the UCount getter, and RetryPolicy::Conservative. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015rcVQiiWyTzoNrsvLSaAfB
This commit is contained in:
@@ -79,19 +79,6 @@ public:
|
||||
}
|
||||
|
||||
|
||||
// Mode and flags (mirroring legacy fields)
|
||||
void SetMode(int m)
|
||||
{
|
||||
mode_ = m;
|
||||
}
|
||||
|
||||
|
||||
[[nodiscard]] int Mode() const
|
||||
{
|
||||
return mode_;
|
||||
}
|
||||
|
||||
|
||||
void SetKillChain(bool on)
|
||||
{
|
||||
kill_ = on ? 1 : 0;
|
||||
@@ -104,18 +91,6 @@ public:
|
||||
}
|
||||
|
||||
|
||||
void SetNoKill(bool on)
|
||||
{
|
||||
no_kill_ = on ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
[[nodiscard]] bool NoKill() const
|
||||
{
|
||||
return no_kill_ != 0;
|
||||
}
|
||||
|
||||
|
||||
// Kill ring API
|
||||
void KillRingClear()
|
||||
{
|
||||
@@ -164,18 +139,6 @@ public:
|
||||
}
|
||||
|
||||
|
||||
void SetDirtyEx(int d)
|
||||
{
|
||||
dirtyex_ = d;
|
||||
}
|
||||
|
||||
|
||||
[[nodiscard]] int DirtyEx() const
|
||||
{
|
||||
return dirtyex_;
|
||||
}
|
||||
|
||||
|
||||
void SetUniversalArg(int uarg, int ucount)
|
||||
{
|
||||
uarg_ = uarg;
|
||||
@@ -189,12 +152,6 @@ public:
|
||||
}
|
||||
|
||||
|
||||
[[nodiscard]] int UCount() const
|
||||
{
|
||||
return ucount_;
|
||||
}
|
||||
|
||||
|
||||
// --- Universal argument control (C-u) ---
|
||||
// Begin or extend a universal argument (like ke's uarg_start)
|
||||
void UArgStart();
|
||||
@@ -209,19 +166,6 @@ public:
|
||||
// If no universal argument active, returns 1.
|
||||
int UArgGet();
|
||||
|
||||
// Repeatable command flag: input layer can mark the next command as repeatable
|
||||
void SetRepeatable(bool on)
|
||||
{
|
||||
repeatable_ = on;
|
||||
}
|
||||
|
||||
|
||||
[[nodiscard]] bool Repeatable() const
|
||||
{
|
||||
return repeatable_;
|
||||
}
|
||||
|
||||
|
||||
// Status message storage. Rendering is renderer-dependent; the editor
|
||||
// merely stores the current message and its timestamp.
|
||||
void SetStatus(const std::string &message);
|
||||
@@ -666,14 +610,10 @@ private:
|
||||
};
|
||||
|
||||
std::size_t rows_ = 0, cols_ = 0;
|
||||
int mode_ = 0;
|
||||
int kill_ = 0; // KILL CHAIN
|
||||
int no_kill_ = 0; // don't kill in delete_row
|
||||
int dirtyex_ = 0;
|
||||
std::string msg_;
|
||||
std::time_t msgtm_ = 0;
|
||||
int uarg_ = 0, ucount_ = 0; // C-u support
|
||||
bool repeatable_ = false; // whether the next command is repeatable
|
||||
|
||||
std::vector<Buffer> buffers_;
|
||||
std::vector<Buffer> *shared_buffers_ = nullptr; // if set, use this instead of buffers_
|
||||
|
||||
Reference in New Issue
Block a user