mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-18 18:38:51 +00:00
Allow seeking in unsynchronized widgets using 'g'. (#1731)
This commit is contained in:
parent
567f852c3a
commit
a4ba6f8b2b
@ -844,8 +844,8 @@ void MainWindow::updateDockActionsChecked()
|
||||
|
||||
MemoryWidgetType MainWindow::getMemoryWidgetTypeToRestore()
|
||||
{
|
||||
if (lastMemoryWidget) {
|
||||
return lastMemoryWidget->getType();
|
||||
if (lastSyncMemoryWidget) {
|
||||
return lastSyncMemoryWidget->getType();
|
||||
}
|
||||
return MemoryWidgetType::Disassembly;
|
||||
}
|
||||
@ -876,8 +876,8 @@ QString MainWindow::getUniqueObjectName(const QString &widgetType) const
|
||||
|
||||
void MainWindow::showMemoryWidget()
|
||||
{
|
||||
if (lastMemoryWidget) {
|
||||
if (lastMemoryWidget->tryRaiseMemoryWidget()) {
|
||||
if (lastSyncMemoryWidget) {
|
||||
if (lastSyncMemoryWidget->tryRaiseMemoryWidget()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -929,8 +929,14 @@ QMenu *MainWindow::createShowInMenu(QWidget *parent, RVA address)
|
||||
void MainWindow::setCurrentMemoryWidget(MemoryDockWidget *memoryWidget)
|
||||
{
|
||||
if (memoryWidget->getSeekable()->isSynchronized()) {
|
||||
lastMemoryWidget = memoryWidget;
|
||||
lastSyncMemoryWidget = memoryWidget;
|
||||
}
|
||||
lastMemoryWidget = memoryWidget;
|
||||
}
|
||||
|
||||
MemoryDockWidget *MainWindow::getLastMemoryWidget()
|
||||
{
|
||||
return lastMemoryWidget;
|
||||
}
|
||||
|
||||
MemoryDockWidget *MainWindow::addNewMemoryWidget(MemoryWidgetType type, RVA address,
|
||||
@ -999,6 +1005,9 @@ void MainWindow::addMemoryDockWidget(MemoryDockWidget *widget)
|
||||
void MainWindow::removeWidget(QDockWidget *widget)
|
||||
{
|
||||
dockWidgets.removeAll(widget);
|
||||
if (lastSyncMemoryWidget == widget) {
|
||||
lastSyncMemoryWidget = nullptr;
|
||||
}
|
||||
if (lastMemoryWidget == widget) {
|
||||
lastMemoryWidget = nullptr;
|
||||
}
|
||||
|
@ -120,6 +120,7 @@ public:
|
||||
|
||||
QMenu *createShowInMenu(QWidget *parent, RVA address);
|
||||
void setCurrentMemoryWidget(MemoryDockWidget* memoryWidget);
|
||||
MemoryDockWidget* getLastMemoryWidget();
|
||||
|
||||
public slots:
|
||||
void finalizeOpen();
|
||||
@ -286,6 +287,7 @@ private:
|
||||
*/
|
||||
QMap<QString, std::function<CutterDockWidget*(MainWindow*, QAction*)>> widgetTypeToConstructorMap;
|
||||
|
||||
MemoryDockWidget* lastSyncMemoryWidget = nullptr;
|
||||
MemoryDockWidget* lastMemoryWidget = nullptr;
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "Omnibar.h"
|
||||
#include "core/MainWindow.h"
|
||||
#include "CutterSeekable.h"
|
||||
|
||||
#include <QStringListModel>
|
||||
#include <QCompleter>
|
||||
@ -69,7 +70,13 @@ void Omnibar::on_gotoEntry_returnPressed()
|
||||
{
|
||||
QString str = this->text();
|
||||
if (!str.isEmpty()) {
|
||||
Core()->seekAndShow(str);
|
||||
if (auto memoryWidget = main->getLastMemoryWidget()) {
|
||||
RVA offset = Core()->math(str);
|
||||
memoryWidget->getSeekable()->seek(offset);
|
||||
memoryWidget->raiseMemoryWidget();
|
||||
} else {
|
||||
Core()->seekAndShow(str);
|
||||
}
|
||||
}
|
||||
|
||||
this->setText("");
|
||||
|
Loading…
Reference in New Issue
Block a user