File indexing completed on 2024-03-24 04:00:56
0001 /* 0002 SPDX-FileCopyrightText: KDE Developers 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "history.h" 0008 0009 using namespace KateVi; 0010 0011 namespace 0012 { 0013 const int HISTORY_SIZE_LIMIT = 100; 0014 } 0015 0016 void History::append(const QString &historyItem) 0017 { 0018 if (historyItem.isEmpty()) { 0019 return; 0020 } 0021 0022 m_items.removeAll(historyItem); 0023 0024 if (m_items.size() == HISTORY_SIZE_LIMIT) { 0025 m_items.removeFirst(); 0026 } 0027 0028 m_items.append(historyItem); 0029 } 0030 0031 void History::clear() 0032 { 0033 m_items.clear(); 0034 }