mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-27 23:37:05 -05:00
Tab insertion was not being recorded for undoing and the shift-backspace shortcut did not exist. This PR addresses both issues directly.
This commit is contained in:
@@ -1559,16 +1559,23 @@ namespace hex::ui {
|
||||
line.insert(line.begin() + charIndex, spaces.begin(), spaces.end());
|
||||
line.m_colorized = false;
|
||||
setCursorPosition(getCharacterCoordinates(coord.m_line, charIndex + spacesToInsert));
|
||||
u.m_added = spaces;
|
||||
u.m_addedSelection.m_end = setCoordinates(m_state.m_cursorPosition);
|
||||
} else {
|
||||
auto spacesToRemove = (charIndex % m_tabSize);
|
||||
if (spacesToRemove == 0) spacesToRemove = m_tabSize;
|
||||
spacesToRemove = std::min(spacesToRemove, (int32_t) line.size());
|
||||
auto spacesRemoved = 0;
|
||||
for (int32_t j = 0; j < spacesToRemove; j++) {
|
||||
if (*(line.begin() + (charIndex - 1)) == ' ') {
|
||||
line.erase(line.begin() + (charIndex - 1));
|
||||
charIndex -= 1;
|
||||
spacesRemoved++;
|
||||
}
|
||||
}
|
||||
std::string spaces(spacesRemoved, ' ');
|
||||
u.m_removed = spaces;
|
||||
u.m_removedSelection = Selection(Coordinates(coord.m_line, charIndex), Coordinates(coord.m_line, charIndex + spacesRemoved));
|
||||
line.m_colorized = false;
|
||||
setCursorPosition(getCharacterCoordinates(coord.m_line, std::max(0, charIndex)));
|
||||
}
|
||||
|
||||
@@ -1025,6 +1025,7 @@
|
||||
"hex.builtin.view.pattern_editor.shortcut.toggle_insert": "Toggle Write Over",
|
||||
"hex.builtin.view.pattern_editor.shortcut.delete": "Delete One Character at the Cursor Position",
|
||||
"hex.builtin.view.pattern_editor.shortcut.backspace": "Delete One Character to the Left of Cursor",
|
||||
"hex.builtin.view.pattern_editor.shortcut.backspace_shifted": "Delete One Character to the Left of Cursor",
|
||||
"hex.builtin.view.pattern_editor.shortcut.select_all": "Select Entire File",
|
||||
"hex.builtin.view.pattern_editor.menu.edit.select_all": "Select All",
|
||||
"hex.builtin.view.pattern_editor.shortcut.select_left": "Extend Selection One Character to the Left of the Cursor",
|
||||
|
||||
@@ -2491,6 +2491,11 @@ namespace hex::plugin::builtin {
|
||||
m_textEditor.get(ImHexApi::Provider::get()).backspace();
|
||||
});
|
||||
|
||||
ShortcutManager::addShortcut(this, SHIFT + Keys::Backspace + AllowWhileTyping, "hex.builtin.view.pattern_editor.shortcut.backspace_shifted", [this] {
|
||||
if (m_focusedSubWindowName.contains(textEditorView))
|
||||
m_textEditor.get(ImHexApi::Provider::get()).backspace();
|
||||
});
|
||||
|
||||
ShortcutManager::addShortcut(this, Keys::Insert + AllowWhileTyping, "hex.builtin.view.pattern_editor.shortcut.toggle_insert", [this] {
|
||||
if (m_focusedSubWindowName.contains(textEditorView))
|
||||
m_textEditor.get(ImHexApi::Provider::get()).setOverwrite(!m_textEditor.get(ImHexApi::Provider::get()).isOverwrite());
|
||||
|
||||
Reference in New Issue
Block a user