Browse Source

InputText: Word-Wrap: amend 7f1e2bb to avoid triggering static analyzer. (#3237, #952, #1062, #7363)

And generally more logical this way anyhow.
ocornut 1 ngày trước cách đây
mục cha
commit
b6a33f8ce1
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      imgui_widgets.cpp

+ 1 - 1
imgui_widgets.cpp

@@ -4594,7 +4594,7 @@ static ImVec2 InputTextLineIndexGetPosOffset(ImGuiContext& g, ImGuiInputTextStat
     int* it_end = line_index->Offsets.end();
     const int* it = ImLowerBound(it_begin, it_end, cursor_n);
     if (it > it_begin)
-        if (it == it_end || *it != cursor_n || (state->WrapWidth > 0.0f && cursor_ptr[-1] != '\n' && cursor_ptr[-1] != 0 && state != NULL && state->LastMoveDirectionLR == ImGuiDir_Right))
+        if (it == it_end || *it != cursor_n || (state != NULL && state->WrapWidth > 0.0f && state->LastMoveDirectionLR == ImGuiDir_Right && cursor_ptr[-1] != '\n' && cursor_ptr[-1] != 0))
             it--;
 
     const int line_no = (it == it_begin) ? 0 : line_index->Offsets.index_from_ptr(it);