瀏覽代碼

InputText: Added '\' and '/' as word seperator. (#7824, #7704)

Adding those seperators means that ctrl+(left|right)-arrows and ctrl+backspace will stop at slashes, which is more inline with how most software works and generally is very convenient when dealing with paths or urls.
Laurent Dufresne 1 年之前
父節點
當前提交
96460a8a12
共有 2 個文件被更改,包括 2 次插入1 次删除
  1. 1 0
      docs/CHANGELOG.txt
  2. 1 1
      imgui_widgets.cpp

+ 1 - 0
docs/CHANGELOG.txt

@@ -146,6 +146,7 @@ Other changes:
     - Multi-Select (advanced)
     - Multi-Select (advanced)
 - Nav: fixed clicking window decorations (e.g. resize borders) from losing focused item when
 - Nav: fixed clicking window decorations (e.g. resize borders) from losing focused item when
   within a child window using ImGuiChildFlags_NavFlattened.
   within a child window using ImGuiChildFlags_NavFlattened.
+- InputText: added '\' and '/' as word seperator. (#7824, #7704) [@reduf]
 - Clipper: added SeekCursorForItem() function. When using ImGuiListClipper::Begin(INT_MAX) you can
 - Clipper: added SeekCursorForItem() function. When using ImGuiListClipper::Begin(INT_MAX) you can
   can use the clipper without knowing the amount of items beforehand. (#1311)
   can use the clipper without knowing the amount of items beforehand. (#1311)
   In this situation, call ImGuiListClipper::SeekCursorForItem(items_count) as the end of your iteration
   In this situation, call ImGuiListClipper::SeekCursorForItem(items_count) as the end of your iteration

+ 1 - 1
imgui_widgets.cpp

@@ -3897,7 +3897,7 @@ static void    STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r, ImGuiInputTextState* ob
 
 
 static bool is_separator(unsigned int c)
 static bool is_separator(unsigned int c)
 {
 {
-    return c==',' || c==';' || c=='(' || c==')' || c=='{' || c=='}' || c=='[' || c==']' || c=='|' || c=='\n' || c=='\r' || c=='.' || c=='!';
+    return c==',' || c==';' || c=='(' || c==')' || c=='{' || c=='}' || c=='[' || c==']' || c=='|' || c=='\n' || c=='\r' || c=='.' || c=='!' || c=='\\' || c=='/';
 }
 }
 
 
 static int is_word_boundary_from_right(ImGuiInputTextState* obj, int idx)
 static int is_word_boundary_from_right(ImGuiInputTextState* obj, int idx)