mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-18 02:25:26 +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
|
||||
* Load initial file. TODO Maybe use the "o" commands?
|
||||
* Load initial file.
|
||||
* @param path File path
|
||||
* @param baddr Base (RzBin) address
|
||||
* @param mapaddr Map address
|
||||
@ -2682,10 +2682,10 @@ QList<RVA> CutterCore::getSeekHistory()
|
||||
{
|
||||
CORE_LOCK();
|
||||
QList<RVA> ret;
|
||||
|
||||
QJsonArray jsonArray = cmdj("sj").array();
|
||||
for (const QJsonValue &value : jsonArray)
|
||||
ret << value.toVariant().toULongLong();
|
||||
RzListIter *it;
|
||||
RzCoreSeekItem *undo;
|
||||
RzList *list = rz_core_seek_list(core);
|
||||
CutterRListForeach(list, it, RzCoreSeekItem, undo) { ret << undo->offset; }
|
||||
|
||||
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
|
||||
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;
|
||||
QList<QAction *> actions;
|
||||
for (auto item : Core()->cmdj("sj").array()) {
|
||||
QJsonObject obj = item.toObject();
|
||||
QString name = obj["name"].toString();
|
||||
RVA offset = obj["offset"].toVariant().toULongLong();
|
||||
bool current = obj["current"].toBool(false);
|
||||
CutterRListForeach(list, it, RzCoreSeekItem, undo) {
|
||||
RzFlagItem *f = rz_flag_get_at(core->flags, undo->offset, true);
|
||||
char *fname = NULL;
|
||||
if (f) {
|
||||
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) {
|
||||
history = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user