diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index bbf76a5892..aff868295a 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -5801,8 +5801,10 @@ Sci::Position Editor::GetTag(char *tagValue, int tagNumber) { const char *text = nullptr; Sci::Position length = 0; if ((tagNumber >= 1) && (tagNumber <= 9)) { - char name[3] = "\\?"; + char name[3]; + name[0] = '\\'; name[1] = static_cast(tagNumber + '0'); + name[2] = '\0'; length = 2; text = pdoc->SubstituteByPosition(name, &length); } @@ -6110,6 +6112,10 @@ constexpr Selection::SelTypes SelTypeFromMode(SelectionMode mode) noexcept { return static_cast(static_cast(mode) + 1); } +constexpr int SelectionModeFromSelType(Selection::SelTypes selType) noexcept { + return std::max(0, static_cast(selType) - 1); +} + } void Editor::SetSelectionMode(uptr_t wParam, bool setMoveExtends) { @@ -6993,15 +6999,17 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { case Message::ClearTabStops: if (view.ClearTabstops(LineFromUPtr(wParam))) { - const DocModification mh(ModificationFlags::ChangeTabStops, 0, 0, 0, nullptr, LineFromUPtr(wParam)); - NotifyModified(pdoc, mh, nullptr); + // const DocModification mh(ModificationFlags::ChangeTabStops, 0, 0, 0, nullptr, LineFromUPtr(wParam)); + // NotifyModified(pdoc, mh, nullptr); + Redraw(); } break; case Message::AddTabStop: if (view.AddTabstop(LineFromUPtr(wParam), static_cast(lParam))) { - const DocModification mh(ModificationFlags::ChangeTabStops, 0, 0, 0, nullptr, LineFromUPtr(wParam)); - NotifyModified(pdoc, mh, nullptr); + // const DocModification mh(ModificationFlags::ChangeTabStops, 0, 0, 0, nullptr, LineFromUPtr(wParam)); + // NotifyModified(pdoc, mh, nullptr); + Redraw(); } break; @@ -7309,9 +7317,9 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { if (wParam <= MarkerMax) { vs.markers[wParam].markType = static_cast(lParam); vs.CalcLargestMarkerHeight(); + InvalidateStyleData(); + RedrawSelMargin(); } - InvalidateStyleData(); - RedrawSelMargin(); break; case Message::MarkerSymbolDefined: @@ -7393,9 +7401,9 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { if (wParam <= MarkerMax) { vs.markers[wParam].SetXPM(ConstCharPtrFromSPtr(lParam)); vs.CalcLargestMarkerHeight(); + InvalidateStyleData(); + RedrawSelMargin(); } - InvalidateStyleData(); - RedrawSelMargin(); break; case Message::RGBAImageSetWidth: @@ -7414,9 +7422,9 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { if (wParam <= MarkerMax) { vs.markers[wParam].SetRGBAImage(sizeRGBAImage, scaleRGBAImage / 100.0f, ConstUCharPtrFromSPtr(lParam)); vs.CalcLargestMarkerHeight(); + InvalidateStyleData(); + RedrawSelMargin(); } - InvalidateStyleData(); - RedrawSelMargin(); break; case Message::SetMarginTypeN: @@ -8256,18 +8264,7 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { SetSelectionMode(wParam, false); break; case Message::GetSelectionMode: - switch (sel.selType) { - case Selection::SelTypes::stream: - return static_cast(SelectionMode::Stream); - case Selection::SelTypes::rectangle: - return static_cast(SelectionMode::Rectangle); - case Selection::SelTypes::lines: - return static_cast(SelectionMode::Lines); - case Selection::SelTypes::thin: - return static_cast(SelectionMode::Thin); - default: // ?! - return static_cast(SelectionMode::Stream); - } + return SelectionModeFromSelType(sel.selType); case Message::SetMoveExtendsSelection: sel.SetMoveExtends(wParam != 0); break; diff --git a/scintilla/src/Editor.h b/scintilla/src/Editor.h index 196c5354b4..55009d6e62 100644 --- a/scintilla/src/Editor.h +++ b/scintilla/src/Editor.h @@ -465,7 +465,7 @@ class Editor : public EditModel, public DocWatcher { virtual int GetCtrlID() const noexcept { return ctrlID; } - virtual void NotifyParent(Scintilla::NotificationData scn) noexcept = 0; + virtual void NotifyParent(Scintilla::NotificationData &scn) const noexcept = 0; virtual void NotifyStyleToNeeded(Sci::Position endStyleNeeded); void NotifyChar(int ch, Scintilla::CharacterSource charSource, bool handled = false) noexcept; void NotifySavePoint(bool isSavePoint) noexcept; diff --git a/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx index 7b00c76372..0c35fed2a7 100644 --- a/scintilla/win32/ScintillaWin.cxx +++ b/scintilla/win32/ScintillaWin.cxx @@ -564,7 +564,7 @@ class ScintillaWin final : void NotifyFocus(bool focus) override; void SetCtrlID(int identifier) noexcept override; int GetCtrlID() const noexcept override; - void NotifyParent(NotificationData scn) noexcept override; + void NotifyParent(NotificationData &scn) const noexcept override; void NotifyDoubleClick(Point pt, KeyMod modifiers) override; std::unique_ptr CaseFolderForEncoding() override; std::string CaseMapString(const std::string &s, CaseMapping caseMapping) const override; @@ -2762,11 +2762,11 @@ int ScintillaWin::GetCtrlID() const noexcept { return ::GetDlgCtrlID(MainHWND()); } -void ScintillaWin::NotifyParent(NotificationData scn) noexcept { +void ScintillaWin::NotifyParent(NotificationData &scn) const noexcept { scn.nmhdr.hwndFrom = MainHWND(); scn.nmhdr.idFrom = GetCtrlID(); ::SendMessage(::GetParent(MainHWND()), WM_NOTIFY, - GetCtrlID(), AsInteger(&scn)); + scn.nmhdr.idFrom, AsInteger(&scn)); } void ScintillaWin::NotifyDoubleClick(Point pt, KeyMod modifiers) {