Skip to content

Commit 12a6d3f

Browse files
committed
Refactor: use suggested changes
1 parent e1e9e6d commit 12a6d3f

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

_posts/2025-10-04-integrating-the-rizin-mark-api-rsoc.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,29 @@ As a second project of my RSoC internship, I worked on integrating the Rizin Mar
1515

1616
You can find the write-up of my first project [here](https://cutter.re/shortcut-manager-rsoc)
1717

18-
## **What Are Marks**
18+
## What Are Marks
1919

2020
**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.
2121

2222
Refer to [RSoC 2025 - Adding Mark API](https://rizin.re/posts/rsoc-2025-mark-api/) for more details about **Marks**.
2323

24-
## **Implementation**
24+
## Implementation
2525

2626
For now, **Marks** are only available in the **Hexdump** widget
2727

28-
### **Adding, Editing and Removing Marks**
28+
### Adding, Editing and Removing Marks
2929

3030
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.
3131

3232
![Add mark dialog box](/assets/images/blog/posts/inetgrating-the-rizin-mark-api-rsoc/mark-add-dialog.png)
3333

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.
3535

3636
![Context menu actions for marks](/assets/images/blog/posts/inetgrating-the-rizin-mark-api-rsoc/mark-context-menu.png)
3737

3838
A default shortcut key `M` was also introduced in `DefaultShortcuts` to quickly trigger the **Add Mark** action.
3939

40-
### **Visualizing Marks**
40+
### Visualizing Marks
4141

4242
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.
4343

@@ -57,15 +57,15 @@ Each mark is then rendered in its assigned color, and finally the **Data bytes**
5757

5858
![Two highlighted marks](/assets/images/blog/posts/inetgrating-the-rizin-mark-api-rsoc/mark-highlight.png)
5959

60-
### **Blending Overlapping Marks**
60+
### Blending Overlapping Marks
6161

6262
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.
6363

6464
![Two highlighted overlapping marks](/assets/images/blog/posts/inetgrating-the-rizin-mark-api-rsoc/mark-highlight-overlap.png)
6565

6666
Here, the **overlapping** region is highlighted by a subtle green color.
6767

68-
### **Tooltip**
68+
### Tooltip
6969

7070
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.
7171

@@ -79,21 +79,21 @@ The **tooltip** is designed to follow the cursor. This was achieved with a small
7979

8080
![Mark tooltip animation](/assets/images/blog/posts/inetgrating-the-rizin-mark-api-rsoc/mark-tooltip-animation.gif)
8181

82-
### **Removing and Editing Overlapping Marks**
82+
### Removing and Editing Overlapping Marks
8383

8484
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.
8585

8686
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.
8787

8888
![Remove mark submenu](/assets/images/blog/posts/inetgrating-the-rizin-mark-api-rsoc/mark-remove-overlap.png)
8989

90-
## **Challenges**
90+
## Challenges
9191

9292
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.
9393

9494
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.
9595

96-
## **Future Improvements**
96+
## Future Improvements
9797

9898
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**.
9999
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
105105

106106
And also extend **Marks** support to different widgets (Disassembly, Graph, etc.).
107107

108-
## **Conclusion**
108+
## Conclusion
109109

110110
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.
111111

_posts/2025-10-04-shortcut-manager-rsoc.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ post_image: "/assets/images/blog/posts/shortcut-manager-rsoc/cover.png"
99
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"
1010
---
1111

12-
# **Shortcut Manager - RSoC Project**
12+
# Shortcut Manager - RSoC Project
1313

1414
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/).
1515

@@ -19,19 +19,19 @@ This was the first project. The main objective of this project was to introduce
1919

2020
You can find the write-up of my second project [here](https://cutter.re/integrating-the-rizin-mark-api-rsoc).
2121

22-
## **Why a Shortcut Manager**
22+
## Why a Shortcut Manager
2323

2424
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.
2525

26-
## **Design Goals**
26+
## Design Goals
2727

2828
The **Shortcut Manager** was designed with three key goals:
2929

3030
1) **Consistency:** Shortcuts should behave uniformly across the application, regardless of whether they originate from a `QAction` or a `QShortcut`.
3131
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.
3232
3) **Extensibility:** The system should provide a solid foundation that can be expanded in the future, enabling features like custom user-defined shortcuts.
3333

34-
## **Implementation**
34+
## Implementation
3535

3636
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.
3737

@@ -47,14 +47,14 @@ A Default Shortcuts widget has also been introduced, allowing users to easily vi
4747

4848
![Cutter Shortcut Filter](/assets/images/blog/posts/shortcut-manager-rsoc/shortcut-widget-filter.gif)
4949

50-
## **Future Improvements**
50+
## Future Improvements
5151

5252
While the **Shortcut Manager** already improves consistency and maintainability, it also lays the groundwork for more advanced functionality:
5353

5454
**Custom Shortcuts:** In the future, users will be able to define and register their own shortcuts through Cutter’s interface.
5555

5656
**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.
5757

58-
## **Conclusion**
58+
## Conclusion
5959

6060
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

Comments
 (0)