aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Document.h
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2025-01-22 21:34:54 +1100
committerNeil <nyamatongwe@gmail.com>2025-01-22 21:34:54 +1100
commit3de9d37c7b8f4501558d309ada718dc52533e94c (patch)
treece87afaff43a86c26c562fefcf0c9a5ea409ef6b /src/Document.h
parentbac32d7fde0b1d052ac9e926c6b3c96afe39bcfd (diff)
downloadscintilla-mirror-3de9d37c7b8f4501558d309ada718dc52533e94c.tar.gz
Bug [#1224]. Remember selection in undo history. SCI_SETSELECTIONUNDOHISTORY.
Diffstat (limited to 'src/Document.h')
-rw-r--r--src/Document.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/Document.h b/src/Document.h
index cecf02899..4e18c42d1 100644
--- a/src/Document.h
+++ b/src/Document.h
@@ -172,6 +172,22 @@ public:
bool isEnabled;
};
+// Base class for view state that can be held and transferred without understanding the contents.
+// Declared here but real implementation subclass declared in EditModel
+struct ViewState {
+ ViewState() noexcept = default;
+ // Deleted so ViewState objects can not be copied
+ ViewState(const ViewState &) = delete;
+ ViewState(ViewState &&) = delete;
+ ViewState &operator=(const ViewState &) = delete;
+ ViewState &operator=(ViewState &&) = delete;
+ virtual ~ViewState() noexcept = default;
+
+ virtual void TruncateUndo(int index)=0;
+};
+
+using ViewStateShared = std::shared_ptr<ViewState>;
+
struct LexerReleaser {
// Called by unique_ptr to destroy/free the Resource
void operator()(Scintilla::ILexer5 *pLexer) noexcept {
@@ -304,6 +320,8 @@ private:
std::unique_ptr<RegexSearchBase> regex;
std::unique_ptr<LexInterface> pli;
+ std::map<void *, ViewStateShared>viewData;
+
public:
Scintilla::EndOfLine eolMode;
@@ -396,8 +414,9 @@ public:
}
bool IsCollectingUndo() const noexcept { return cb.IsCollectingUndo(); }
void BeginUndoAction(bool coalesceWithPrior=false) noexcept { cb.BeginUndoAction(coalesceWithPrior); }
- void EndUndoAction() noexcept { cb.EndUndoAction(); }
+ void EndUndoAction() noexcept;
int UndoSequenceDepth() const noexcept;
+ bool AfterUndoSequenceStart() const noexcept { return cb.AfterUndoSequenceStart(); }
void AddUndoAction(Sci::Position token, bool mayCoalesce) { cb.AddUndoAction(token, mayCoalesce); }
void SetSavePoint();
bool IsSavePoint() const noexcept { return cb.IsSavePoint(); }
@@ -534,6 +553,10 @@ public:
LexInterface *GetLexInterface() const noexcept;
void SetLexInterface(std::unique_ptr<LexInterface> pLexInterface) noexcept;
+ void SetViewState(void *view, ViewStateShared pVSS);
+ ViewStateShared GetViewState(void *view) const noexcept;
+ void TruncateUndoComments(int action);
+
int SCI_METHOD SetLineState(Sci_Position line, int state) override;
int SCI_METHOD GetLineState(Sci_Position line) const override;
Sci::Line GetMaxLineState() const noexcept;
@@ -574,6 +597,7 @@ public:
private:
void NotifyModifyAttempt();
void NotifySavePoint(bool atSavePoint);
+ void NotifyGroupCompleted() noexcept;
void NotifyModified(DocModification mh);
};
@@ -664,6 +688,7 @@ public:
virtual void NotifyDeleted(Document *doc, void *userData) noexcept = 0;
virtual void NotifyStyleNeeded(Document *doc, void *userData, Sci::Position endPos) = 0;
virtual void NotifyErrorOccurred(Document *doc, void *userData, Scintilla::Status status) = 0;
+ virtual void NotifyGroupCompleted(Document *doc, void *userData) noexcept = 0;
};
}