Scintilla 5.0.3 released

56 views
Skip to first unread message

Neil Hodgson

unread,
Jun 2, 2021, 12:26:43 AM6/2/21
to Scintilla mailing list
Scintilla 5.0.3 is now available from the scintilla.org web site.

Scintilla 5.0.3 is an unstable release.

A more type-safe binding of Scintilla's API that can be used from C++ is implemented in the ScintillaTypes.h, ScintillaMessages.h, and ScintillaStructures.h headers. This particularly impacts Qt where type names are encoded into signal names. Qt users should check their signal connection code and change as necessary. For example, “SCNotification” becomes “Scintilla::NotificationData”.

Drawing of selections, carets, caret line, and hot-spots have changed significantly with more modes and drawing options. You should check whether your current selection settings work well in all modes: normal, additional (or rectangular), inactive and, on Unix, secondary. If there are problems, the newer APIs should be used: first decide which layer you want the selection to be drawn on (SCI_SETSELECTIONLAYER) then use the element APIs (starting with SCI_SETELEMENTCOLOUR) to choose colour/translucency for each state. On macOS + Cocoa experiment with using system settings with SCI_RESETELEMENTCOLOUR.

It is likely that there will only be bug fix releases before a stable 5.1.0. The only planned upcoming (rarely) incompatible change is to update the representation feature with representations always in UTF-8.

Idle actions, wrapping and styling, may be smoother as they measure speed by byte instead of line which could be perturbed by huge lines.

Primary selection fixed on GTK 3 + Wayland.

A C++17 compiler is required to build Scintilla. Microsoft Visual C++ 2019, GCC 7.3, Clang 6.0, Xcode 9.2 Clang or newer will work. Some slightly older compilers may still work.

A list of changes is available on the history page.
http://www.scintilla.org/ScintillaHistory.html

Scintilla uses Mercurial (Hg) for source code control. The repository can be cloned with
hg clone http://hg.code.sf.net/p/scintilla/code scintilla

Thanks to the contributors of code and documentation and to the testers.

Neil

Wonson

unread,
May 21, 2025, 1:21:39 AMMay 21
to scintilla-interest
But why does mac need reinterpret_cast back into the old SCNotification instead of using the new one?
Is there any way to make it align with others?

void ScintillaCocoa::NotifyParent(NotificationData scn) {
scn.nmhdr.hwndFrom = (void *) this;
scn.nmhdr.idFrom = GetCtrlID();
if (notifyProc != NULL)
notifyProc(notifyObj, WM_NOTIFY, GetCtrlID(), (uintptr_t) &scn);
if (delegate)
[delegate notification: reinterpret_cast<SCNotification *>(&scn)];
if (scn.nmhdr.code == Notification::UpdateUI) {
NSView *content = ContentView();
if (FlagSet(scn.updated, Update::Content)) {
NSAccessibilityPostNotification(content, NSAccessibilityValueChangedNotification);
}
if (FlagSet(scn.updated, Update::Selection)) {
NSAccessibilityPostNotification(content, NSAccessibilitySelectedTextChangedNotification);
}
}
}


Neil Hodgson 在 2021年6月2日 星期三清晨5:26:43 [UTC+1] 的信中寫道:

Wonson

unread,
May 21, 2025, 2:56:35 AMMay 21
to scintilla-interest
Made a patch, it seems working and simple.

diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm
index b1e242c..1c90154 100644
--- a/cocoa/ScintillaCocoa.mm
+++ b/cocoa/ScintillaCocoa.mm
@@ -2124,7 +2124,7 @@ - (void) pasteboard: (NSPasteboard *) pasteboard item: (NSPasteboardItem *) item

  if (notifyProc != NULL)
  notifyProc(notifyObj, WM_NOTIFY, GetCtrlID(), (uintptr_t) &scn);
  if (delegate)
- [delegate notification: reinterpret_cast<SCNotification *>(&scn)];
+ [delegate notification: &scn];

  if (scn.nmhdr.code == Notification::UpdateUI) {
  NSView *content = ContentView();
  if (FlagSet(scn.updated, Update::Content)) {
diff --git a/cocoa/ScintillaView.h b/cocoa/ScintillaView.h
index 7cce93e..3f13061 100644
--- a/cocoa/ScintillaView.h
+++ b/cocoa/ScintillaView.h
@@ -39,7 +39,7 @@ typedef void(*SciNotifyFunc)(intptr_t windowid, unsigned int iMessage, uintptr_t
 extern NSString *const SCIUpdateUINotification;
 
 @protocol ScintillaNotificationProtocol
-- (void) notification: (SCNotification *) notification;
+- (void) notification: (Scintilla::NotificationData *) notification;
 @end
 
 /**
@@ -88,7 +88,7 @@ extern NSString *const SCIUpdateUINotification;
 - (void) setCallback: (id <InfoBarCommunicator>) callback;
 
 - (void) suspendDrawing: (BOOL) suspend;
-- (void) notification: (SCNotification *) notification;
+- (void) notification: (Scintilla::NotificationData *) notification;
 
 - (void) updateIndicatorIME;
 
diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm
index 5e9e641..a9ff0ae 100644
--- a/cocoa/ScintillaView.mm
+++ b/cocoa/ScintillaView.mm
@@ -1385,13 +1385,13 @@ - (void) suspendDrawing: (BOOL) suspend {
  * A delegate can be set to receive all notifications. If set no handling takes place here, except
  * for action pertaining to internal stuff (like the info bar).
  */
-- (void) notification: (SCNotification *) scn {
+- (void) notification: (Scintilla::NotificationData *) scn {
  // Parent notification. Details are passed as SCNotification structure.
 
  if (mDelegate != nil) {
  [mDelegate notification: scn];
- if (scn->nmhdr.code != static_cast<unsigned int>(Notification::Zoom) &&
-     scn->nmhdr.code != static_cast<unsigned int>(Notification::UpdateUI))
+ if (scn->nmhdr.code != (Notification::Zoom) &&
+     scn->nmhdr.code != (Notification::UpdateUI))
  return;
  }
 
@@ -1407,8 +1407,7 @@ - (void) notification: (SCNotification *) scn {
  case Notification::Modified: {
  // Decide depending on the modification type what to do.
  // There can be more than one modification carried by one notification.
- if (scn->modificationType &
- static_cast<int>((ModificationFlags::InsertText | ModificationFlags::DeleteText)))
+ if (FlagSet(scn->modificationType, (ModificationFlags::InsertText | ModificationFlags::DeleteText)))
  [self sendNotification: NSTextDidChangeNotification];
  break;
  }
@@ -1426,7 +1425,7 @@ - (void) notification: (SCNotification *) scn {
  NSPoint caretPosition = mBackend->GetCaretPosition();
  [mInfoBar notify: IBNCaretChanged message: nil location: caretPosition value: 0];
  [self sendNotification: SCIUpdateUINotification];
- if (scn->updated & static_cast<int>((Update::Selection | Update::Content))) {
+        if (FlagSet(scn->updated, (Update::Selection | Update::Content))) {
  [self sendNotification: NSTextViewDidChangeSelectionNotification];
  }
  break;


Wonson 在 2025年5月21日 星期三清晨6:21:39 [UTC+1] 的信中寫道:

Neil

unread,
May 21, 2025, 3:36:03 AMMay 21
to scintilla-interest
Wonson:
But why does mac need reinterpret_cast back into the old SCNotification instead of using the new one?
Is there any way to make it align with others?
...
if (delegate)
[delegate notification: reinterpret_cast<SCNotification *>(&scn)];

Because the ScintillaNotificationProtocol is a published API that may be implemented by application code so must remain completely compatible.

Neil
Reply all
Reply to author
Forward
0 new messages