mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-18 18:38:51 +00:00
Use seek history API instead of command (#2754)
This commit is contained in:
parent
0dcdb0f1e9
commit
e219be4253
@ -585,7 +585,7 @@ QStringList CutterCore::autocomplete(const QString &cmd, RzLinePromptType prompt
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief CutterCore::loadFile
|
* @brief CutterCore::loadFile
|
||||||
* Load initial file. TODO Maybe use the "o" commands?
|
* Load initial file.
|
||||||
* @param path File path
|
* @param path File path
|
||||||
* @param baddr Base (RzBin) address
|
* @param baddr Base (RzBin) address
|
||||||
* @param mapaddr Map address
|
* @param mapaddr Map address
|
||||||
@ -2682,10 +2682,10 @@ QList<RVA> CutterCore::getSeekHistory()
|
|||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
QList<RVA> ret;
|
QList<RVA> ret;
|
||||||
|
RzListIter *it;
|
||||||
QJsonArray jsonArray = cmdj("sj").array();
|
RzCoreSeekItem *undo;
|
||||||
for (const QJsonValue &value : jsonArray)
|
RzList *list = rz_core_seek_list(core);
|
||||||
ret << value.toVariant().toULongLong();
|
CutterRListForeach(list, it, RzCoreSeekItem, undo) { ret << undo->offset; }
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1127,14 +1127,26 @@ void MainWindow::updateHistoryMenu(QMenu *menu, bool redo)
|
|||||||
// not too short so that reasonable length c++ names can be seen most of the time
|
// not too short so that reasonable length c++ names can be seen most of the time
|
||||||
const int MAX_NAME_LENGTH = 64;
|
const int MAX_NAME_LENGTH = 64;
|
||||||
|
|
||||||
auto hist = Core()->cmdj("sj");
|
RzListIter *it;
|
||||||
|
RzCoreSeekItem *undo;
|
||||||
|
RzCoreLocked core(Core());
|
||||||
|
RzList *list = rz_core_seek_list(core);
|
||||||
|
|
||||||
bool history = true;
|
bool history = true;
|
||||||
QList<QAction *> actions;
|
QList<QAction *> actions;
|
||||||
for (auto item : Core()->cmdj("sj").array()) {
|
CutterRListForeach(list, it, RzCoreSeekItem, undo) {
|
||||||
QJsonObject obj = item.toObject();
|
RzFlagItem *f = rz_flag_get_at(core->flags, undo->offset, true);
|
||||||
QString name = obj["name"].toString();
|
char *fname = NULL;
|
||||||
RVA offset = obj["offset"].toVariant().toULongLong();
|
if (f) {
|
||||||
bool current = obj["current"].toBool(false);
|
if (f->offset != undo->offset) {
|
||||||
|
fname = rz_str_newf("%s+%" PFMT64d, f->name, undo->offset - f->offset);
|
||||||
|
} else {
|
||||||
|
fname = strdup(f->name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QString name = fname;
|
||||||
|
RVA offset = undo->offset;
|
||||||
|
bool current = undo->is_current;
|
||||||
if (current) {
|
if (current) {
|
||||||
history = false;
|
history = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user