You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/2025-10-04-integrating-the-rizin-mark-api-rsoc.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,29 +15,29 @@ As a second project of my RSoC internship, I worked on integrating the Rizin Mar
15
15
16
16
You can find the write-up of my first project [here](https://cutter.re/shortcut-manager-rsoc)
17
17
18
-
## **What Are Marks**
18
+
## What Are Marks
19
19
20
20
**Marks** in Rizin let you label a range of memory addresses with a name, comment, or even a color. They’re a way to keep track of important regions in a binary.
21
21
22
22
Refer to [RSoC 2025 - Adding Mark API](https://rizin.re/posts/rsoc-2025-mark-api/) for more details about **Marks**.
23
23
24
-
## **Implementation**
24
+
## Implementation
25
25
26
26
For now, **Marks** are only available in the **Hexdump** widget
27
27
28
-
### **Adding, Editing and Removing Marks**
28
+
### Adding, Editing and Removing Marks
29
29
30
30
To make working with marks more user-friendly, we introduced a dedicated dialog in Cutter. This dialog, implemented in `MarkDialog`, takes user input and communicates with the `Core()` instance to add or edit marks. Through it, users can visually set the start and end addresses, give the mark a name, add a comment, and even pick a color.
31
31
32
32

33
33
34
-
Actions for adding, editing, and removing marks are integrated into the **context menu**.
34
+
Actions for adding, editing, and removing marks are integrated into the context menu.
35
35
36
36

37
37
38
38
A default shortcut key `M` was also introduced in `DefaultShortcuts` to quickly trigger the **Add Mark** action.
39
39
40
-
### **Visualizing Marks**
40
+
### Visualizing Marks
41
41
42
42
Once adding and editing marks was in place, the next step was to give them a proper visual representation. This happens directly inside the `Hexdump` widget. Before drawing the **Data bytes** and **ASCII** characters, the widget first queries the `Core()` instance for all mark items that overlap with the current **viewport**. These are collected in a `MarkDescription` container.
43
43
@@ -57,15 +57,15 @@ Each mark is then rendered in its assigned color, and finally the **Data bytes**
To handle **overlapping Marks**, their colors are blended to create a combined color for the overlapping region. This is achieved by setting the alpha of each mark’s color to **50%**, allowing the `QPainter` object to automatically mix them when drawing the overlapped areas.
Here, the **overlapping** region is highlighted by a subtle green color.
67
67
68
-
### **Tooltip**
68
+
### Tooltip
69
69
70
70
To help distinguish between different marks, we use `QToolTip`. When the user hovers over a marked address, a **tooltip** appears showing a small colored circle along with the mark’s name.
71
71
@@ -79,21 +79,21 @@ The **tooltip** is designed to follow the cursor. This was achieved with a small
Since our feature now supports overlapping marks, we needed a way to remove or edit a mark that is completely contained inside another mark. Previously, the only way to access such a mark was by first removing the marks on top of it and then re-adding them, which was inconvenient.
85
85
86
86
To solve this, the **Remove** and **Edit** actions in the context menu now list all of the marks present at the selected address along with their names. This allows the user to directly choose which mark to edit or remove without disturbing the others.
87
87
88
88

89
89
90
-
## **Challenges**
90
+
## Challenges
91
91
92
92
Everything worked fine until we hit an issue: whenever the cursor moved inside a highlighted mark range, the background reverted to Cutter’s default color instead of staying with the mark’s highlight. This happened because the cursor redraw overwrote the background each time it moved.
93
93
94
94
If there was only one mark at the cursor address, fixing this would be easy: just query the mark and repaint the background with its color. But since multiple marks can overlap at the same address, we needed a smarter approach. To solve this, we introduced a helper function `getBlendedMarksColorAt()` inside `CutterCore`, which calculates the final blended color for all marks at a given address.
95
95
96
-
## **Future Improvements**
96
+
## Future Improvements
97
97
98
98
A cool idea for future work could be to create another tab alongside the **Parsing** and **Information** tabs in the right panel, dedicated to **Marks**.
99
99
This tab would display all added marks in a table-like view with their names and allow quick interaction.
@@ -105,7 +105,7 @@ Additionally, double-clicking on a row could automatically move the **cursor** a
105
105
106
106
And also extend **Marks** support to different widgets (Disassembly, Graph, etc.).
107
107
108
-
## **Conclusion**
108
+
## Conclusion
109
109
110
110
The integration of the Rizin Mark API in Cutter enables adding, editing, and managing overlapping marks directly in the Hexdump. With tooltips and context menu actions, it streamlines annotating binaries while leaving room for future enhancements.
description: "Introducing a centralized Shortcut Manager in Cutter for improved consistency and maintainability. Read about the improvements made possible by Emad Sohail, an RSoC student"
10
10
---
11
11
12
-
# **Shortcut Manager - RSoC Project**
12
+
# Shortcut Manager - RSoC Project
13
13
14
14
Greetings! I'm Emad Sohail (aka PremadeS), a 2nd-year CS undergraduate student at Information Technology University - Lahore. You can find me on [Github](https://github.com/PremadeS) and [LinkedIn](https://www.linkedin.com/in/emad-sohail-130b3b265/).
15
15
@@ -19,19 +19,19 @@ This was the first project. The main objective of this project was to introduce
19
19
20
20
You can find the write-up of my second project [here](https://cutter.re/integrating-the-rizin-mark-api-rsoc).
21
21
22
-
## **Why a Shortcut Manager**
22
+
## Why a Shortcut Manager
23
23
24
24
Default key sequences, *also referred to here as shortcuts*, were previously defined in their respective classes. While this approach works if the codebase is small, it becomes exceptionally difficult to manage as the project grows, making it hard to keep track of which shortcuts are assigned to which functions. On top of that, because the key sequences were scattered across different files, there was no way to create a centralized view that allows the user to see the default shortcuts and their respective actions.
25
25
26
-
## **Design Goals**
26
+
## Design Goals
27
27
28
28
The **Shortcut Manager** was designed with three key goals:
29
29
30
30
1)**Consistency:** Shortcuts should behave uniformly across the application, regardless of whether they originate from a `QAction` or a `QShortcut`.
31
31
2)**Maintainability:** All default shortcuts must be in the same place, allowing developers to quickly add, remove, or edit key sequences without needing to look through multiple files.
32
32
3)**Extensibility:** The system should provide a solid foundation that can be expanded in the future, enabling features like custom user-defined shortcuts.
33
33
34
-
## **Implementation**
34
+
## Implementation
35
35
36
36
Default key sequences are stored in a `Shortcut` struct, each mapped to a unique ID within `shortcuts/DefaultShortcuts` using a **hashmap**. The `Shortcut` struct holds both the key sequence and a descriptive text string, along with a context string that is particularly useful for translations.
37
37
@@ -47,14 +47,14 @@ A Default Shortcuts widget has also been introduced, allowing users to easily vi
While the **Shortcut Manager** already improves consistency and maintainability, it also lays the groundwork for more advanced functionality:
53
53
54
54
**Custom Shortcuts:** In the future, users will be able to define and register their own shortcuts through Cutter’s interface.
55
55
56
56
**Profiles and Configurations:** A logical next step would be to allow different sets of shortcuts for different profiles or workflows, making it easier to switch between tailored setups.
57
57
58
-
## **Conclusion**
58
+
## Conclusion
59
59
60
60
The introduction of the **Shortcut Manager** marks an important step in making Cutter more user-friendly and maintainable. By centralizing shortcuts, we’ve eliminated fragmentation in the codebase while also opening the door to future enhancements. While the project itself was relatively small in terms of code changes and complexity, its impact and long-term benefits are substantial.
0 commit comments