Skip to content

Commit 8927d95

Browse files
authored
Merge pull request BalazsJako#29 from sonoro1234/santa_master_imguikey
GetKeyIndex is nop since 1.87+ and obsoleted from 1.90.5 b
2 parents 00c9fcb + 33b803a commit 8927d95

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

TextEditor.cpp

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include <algorithm>
22
#include <string>
3-
#include <cmath>
43
#include <set>
54

65
#include "TextEditor.h"
@@ -2000,71 +1999,71 @@ void TextEditor::HandleKeyboardInputs(bool aParentIsFocused)
20001999
io.WantCaptureKeyboard = true;
20012000
io.WantTextInput = true;
20022001

2003-
if (!mReadOnly && isShortcut && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Z)))
2002+
if (!mReadOnly && isShortcut && ImGui::IsKeyPressed(ImGuiKey_Z))
20042003
Undo();
2005-
else if (!mReadOnly && isAltOnly && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Backspace)))
2004+
else if (!mReadOnly && isAltOnly && ImGui::IsKeyPressed(ImGuiKey_Backspace))
20062005
Undo();
2007-
else if (!mReadOnly && isShortcut && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Y)))
2006+
else if (!mReadOnly && isShortcut && ImGui::IsKeyPressed(ImGuiKey_Y))
20082007
Redo();
2009-
else if (!mReadOnly && isShiftShortcut && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Z)))
2008+
else if (!mReadOnly && isShiftShortcut && ImGui::IsKeyPressed(ImGuiKey_Z))
20102009
Redo();
2011-
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_UpArrow)))
2010+
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGuiKey_UpArrow))
20122011
MoveUp(1, shift);
2013-
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_DownArrow)))
2012+
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGuiKey_DownArrow))
20142013
MoveDown(1, shift);
2015-
else if ((isOSX ? !ctrl : !alt) && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_LeftArrow)))
2014+
else if ((isOSX ? !ctrl : !alt) && !super && ImGui::IsKeyPressed(ImGuiKey_LeftArrow))
20162015
MoveLeft(shift, isWordmoveKey);
2017-
else if ((isOSX ? !ctrl : !alt) && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_RightArrow)))
2016+
else if ((isOSX ? !ctrl : !alt) && !super && ImGui::IsKeyPressed(ImGuiKey_RightArrow))
20182017
MoveRight(shift, isWordmoveKey);
2019-
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_PageUp)))
2018+
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGuiKey_PageUp))
20202019
MoveUp(mVisibleLineCount - 2, shift);
2021-
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_PageDown)))
2020+
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGuiKey_PageDown))
20222021
MoveDown(mVisibleLineCount - 2, shift);
2023-
else if (ctrl && !alt && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Home)))
2022+
else if (ctrl && !alt && !super && ImGui::IsKeyPressed(ImGuiKey_Home))
20242023
MoveTop(shift);
2025-
else if (ctrl && !alt && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_End)))
2024+
else if (ctrl && !alt && !super && ImGui::IsKeyPressed(ImGuiKey_End))
20262025
MoveBottom(shift);
2027-
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Home)))
2026+
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGuiKey_Home))
20282027
MoveHome(shift);
2029-
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_End)))
2028+
else if (!alt && !ctrl && !super && ImGui::IsKeyPressed(ImGuiKey_End))
20302029
MoveEnd(shift);
2031-
else if (!mReadOnly && !alt && !shift && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Delete)))
2030+
else if (!mReadOnly && !alt && !shift && !super && ImGui::IsKeyPressed(ImGuiKey_Delete))
20322031
Delete(ctrl);
2033-
else if (!mReadOnly && !alt && !shift && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Backspace)))
2032+
else if (!mReadOnly && !alt && !shift && !super && ImGui::IsKeyPressed(ImGuiKey_Backspace))
20342033
Backspace(ctrl);
2035-
else if (!mReadOnly && !alt && ctrl && shift && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_K)))
2034+
else if (!mReadOnly && !alt && ctrl && shift && !super && ImGui::IsKeyPressed(ImGuiKey_K))
20362035
RemoveCurrentLines();
2037-
else if (!mReadOnly && !alt && ctrl && !shift && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_LeftBracket)))
2036+
else if (!mReadOnly && !alt && ctrl && !shift && !super && ImGui::IsKeyPressed(ImGuiKey_LeftBracket))
20382037
ChangeCurrentLinesIndentation(false);
2039-
else if (!mReadOnly && !alt && ctrl && !shift && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_RightBracket)))
2038+
else if (!mReadOnly && !alt && ctrl && !shift && !super && ImGui::IsKeyPressed(ImGuiKey_RightBracket))
20402039
ChangeCurrentLinesIndentation(true);
2041-
else if (!alt && ctrl && shift && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_UpArrow)))
2040+
else if (!alt && ctrl && shift && !super && ImGui::IsKeyPressed(ImGuiKey_UpArrow))
20422041
MoveUpCurrentLines();
2043-
else if (!alt && ctrl && shift && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_DownArrow)))
2042+
else if (!alt && ctrl && shift && !super && ImGui::IsKeyPressed(ImGuiKey_DownArrow))
20442043
MoveDownCurrentLines();
2045-
else if (!mReadOnly && !alt && ctrl && !shift && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Slash)))
2044+
else if (!mReadOnly && !alt && ctrl && !shift && !super && ImGui::IsKeyPressed(ImGuiKey_Slash))
20462045
ToggleLineComment();
2047-
else if (!alt && !ctrl && !shift && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Insert)))
2046+
else if (!alt && !ctrl && !shift && !super && ImGui::IsKeyPressed(ImGuiKey_Insert))
20482047
mOverwrite ^= true;
2049-
else if (isCtrlOnly && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Insert)))
2048+
else if (isCtrlOnly && ImGui::IsKeyPressed(ImGuiKey_Insert))
20502049
Copy();
2051-
else if (isShortcut && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_C)))
2050+
else if (isShortcut && ImGui::IsKeyPressed(ImGuiKey_C))
20522051
Copy();
2053-
else if (!mReadOnly && isShiftOnly && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Insert)))
2052+
else if (!mReadOnly && isShiftOnly && ImGui::IsKeyPressed(ImGuiKey_Insert))
20542053
Paste();
2055-
else if (!mReadOnly && isShortcut && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_V)))
2054+
else if (!mReadOnly && isShortcut && ImGui::IsKeyPressed(ImGuiKey_V))
20562055
Paste();
2057-
else if (isShortcut && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_X)))
2056+
else if (isShortcut && ImGui::IsKeyPressed(ImGuiKey_X))
20582057
Cut();
2059-
else if (isShiftOnly && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Delete)))
2058+
else if (isShiftOnly && ImGui::IsKeyPressed(ImGuiKey_Delete))
20602059
Cut();
2061-
else if (isShortcut && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_A)))
2060+
else if (isShortcut && ImGui::IsKeyPressed(ImGuiKey_A))
20622061
SelectAll();
2063-
else if (isShortcut && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_D)))
2062+
else if (isShortcut && ImGui::IsKeyPressed(ImGuiKey_D))
20642063
AddCursorForNextOccurrence();
2065-
else if (!mReadOnly && !alt && !ctrl && !shift && !super && (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Enter)) || ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_KeypadEnter))))
2064+
else if (!mReadOnly && !alt && !ctrl && !shift && !super && (ImGui::IsKeyPressed(ImGuiKey_Enter) || ImGui::IsKeyPressed(ImGuiKey_KeypadEnter)))
20662065
EnterCharacter('\n', false);
2067-
else if (!mReadOnly && !alt && !ctrl && !super && ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Tab)))
2066+
else if (!mReadOnly && !alt && !ctrl && !super && ImGui::IsKeyPressed(ImGuiKey_Tab))
20682067
EnterCharacter('\t', shift);
20692068
if (!mReadOnly && !io.InputQueueCharacters.empty() && ctrl == alt && !super)
20702069
{

TextEditor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma once
22

3+
#include <cmath>
34
#include <cassert>
45
#include <iostream>
56
#include <string>

0 commit comments

Comments
 (0)