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

レイアウト処理の負荷を下げる為、コメントが色分け表示対象外になる機会を増やす #1052

Merged
merged 2 commits into from
Sep 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion sakura_core/doc/CLineComment.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CLineComment
void CopyTo( const int n, const wchar_t* buffer, int nCommentPos ); // 行コメントデリミタをコピーする
bool Match( int nPos, const CStringRef& cStr ) const; // 行コメントに値するか確認する

const wchar_t* getLineComment( const int n ){
const wchar_t* getLineComment( const int n ) const{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

変更の趣旨と関係ないように思うんですが、変更には賛成です。

constなデータを参照するのに非constメソッドとしていることに違和感を感じました。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disp は const メソッドなのでそこから呼び出すには const る必要があるはずです。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

すんません。

無関係に思う ⇒ 関係大アリです。

了解っす 😢

return m_pszLineComment[n];
}
int getLineCommentPos( const int n ) const {
Expand Down
21 changes: 19 additions & 2 deletions sakura_core/view/colors/CColor_Comment.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,18 @@ class CColor_LineComment : public CColorStrategy{
virtual void InitStrategyStatus(){}
virtual bool BeginColor(const CStringRef& cStr, int nPos);
virtual bool EndColor(const CStringRef& cStr, int nPos);
virtual bool Disp() const { return m_pTypeData->m_ColorInfoArr[COLORIDX_COMMENT].m_bDisp; }
virtual bool Disp() const {
// タイプ別設定 『カラー』プロパティのコメントのリストアイテムのチェックが付いているか
if (!m_pTypeData->m_ColorInfoArr[COLORIDX_COMMENT].m_bDisp)
return false;
// 行型コメントの始点記号が入力されているか
auto& lineComment = m_pTypeData->m_cLineComment;
for (int i = 0; i < COMMENT_DELIMITER_NUM; ++i) {
if (lineComment.getLineComment(i)[0])
return true;
}
return false;
}
};

// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- //
Expand All @@ -57,7 +68,13 @@ class CColor_BlockComment : public CColorStrategy{
virtual void InitStrategyStatus(){ m_nCOMMENTEND = 0; }
virtual bool BeginColor(const CStringRef& cStr, int nPos);
virtual bool EndColor(const CStringRef& cStr, int nPos);
virtual bool Disp() const { return m_pTypeData->m_ColorInfoArr[COLORIDX_COMMENT].m_bDisp; }
virtual bool Disp() const {
// タイプ別設定 『カラー』プロパティのコメントのリストアイテムのチェックが付いているか
if (!m_pTypeData->m_ColorInfoArr[COLORIDX_COMMENT].m_bDisp)
berryzplus marked this conversation as resolved.
Show resolved Hide resolved
return false;
// ブロック型の始点・終端記号が入力されているか
return m_pcBlockComment->getBlockFromLen() > 0 && m_pcBlockComment->getBlockToLen() > 0;
}
private:
EColorIndexType m_nType;
const CBlockComment* m_pcBlockComment;
Expand Down