From d8aca4b3af308eed001204846025634a77a4211f Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 14 Jan 2014 19:08:34 +1100 Subject: CallTipSetPosStart API added. --- doc/ScintillaDoc.html | 6 ++++-- doc/ScintillaHistory.html | 5 ++++- include/Scintilla.h | 1 + include/Scintilla.iface | 3 +++ src/ScintillaBase.cxx | 4 ++++ test/simpleTests.py | 21 +++++++++++++++++++++ 6 files changed, 37 insertions(+), 3 deletions(-) diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 2a4c1f8b7..1aaab5307 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -82,7 +82,7 @@

Scintilla Documentation

-

Last edited 10 January 2014 NH

+

Last edited 14 January 2014 NH

There is an overview of the internal design of Scintilla.
@@ -4446,6 +4446,7 @@ struct Sci_TextToFind { SCI_CALLTIPCANCEL
SCI_CALLTIPACTIVE
SCI_CALLTIPPOSSTART
+ SCI_CALLTIPSETPOSSTART(int posStart)
SCI_CALLTIPSETHLT(int highlightStart, int highlightEnd)
SCI_CALLTIPSETBACK(int colour)
@@ -4481,7 +4482,8 @@ struct Sci_TextToFind { This returns 1 if a call tip is active and 0 if it is not active.

SCI_CALLTIPPOSSTART
- This message returns the value of the current position when SCI_CALLTIPSHOW + SCI_CALLTIPSETPOSSTART(int posStart)
+ This message returns or sets the value of the current position when SCI_CALLTIPSHOW started to display the tip.

SCI_CALLTIPSETHLT(int hlStart, int hlEnd)
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index ec1e76982..1a96ad1db 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -459,7 +459,10 @@ Released 12 December 2013.

  • - Added DropSelectionN API to drop a selection from a multiple selection. + DropSelectionN API added to drop a selection from a multiple selection. +
  • +
  • + CallTipSetPosStart API added to change the position at which backspacing removes the calltip.
  • Basic lexer highlights hex, octal, and binary numbers in FreeBASIC which use the prefixes diff --git a/include/Scintilla.h b/include/Scintilla.h index 39171bad4..dda068d75 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -417,6 +417,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_CALLTIPCANCEL 2201 #define SCI_CALLTIPACTIVE 2202 #define SCI_CALLTIPPOSSTART 2203 +#define SCI_CALLTIPSETPOSSTART 2214 #define SCI_CALLTIPSETHLT 2204 #define SCI_CALLTIPSETBACK 2205 #define SCI_CALLTIPSETFORE 2206 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 7b38eb852..32a797251 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -1042,6 +1042,9 @@ fun bool CallTipActive=2202(,) # Retrieve the position where the caret was before displaying the call tip. fun position CallTipPosStart=2203(,) +# Set the start position in order to change when backspacing removes the calltip. +set void CallTipSetPosStart=2214(int posStart,) + # Highlight a segment of the definition. fun void CallTipSetHlt=2204(int start, int end) diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index ad45a5ad2..7850316e9 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -893,6 +893,10 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara case SCI_CALLTIPPOSSTART: return ct.posStartCallTip; + case SCI_CALLTIPSETPOSSTART: + ct.posStartCallTip = wParam; + break; + case SCI_CALLTIPSETHLT: ct.SetHighlight(wParam, lParam); break; diff --git a/test/simpleTests.py b/test/simpleTests.py index 151ee33e8..3ca01f569 100644 --- a/test/simpleTests.py +++ b/test/simpleTests.py @@ -1803,6 +1803,27 @@ class TestSubStyles(unittest.TestCase): inactiveDistance = self.ed.DistanceToSecondaryStyles() self.assertEquals(self.ed.GetPrimaryStyleFromStyle(self.ed.SCE_C_IDENTIFIER+inactiveDistance), self.ed.SCE_C_IDENTIFIER) +class TestCallTip(unittest.TestCase): + + def setUp(self): + self.xite = Xite.xiteFrame + self.ed = self.xite.ed + self.ed.ClearAll() + self.ed.EmptyUndoBuffer() + # 1 line of 4 characters + t = b"fun(" + self.ed.AddText(len(t), t) + + def testBasics(self): + self.assertEquals(self.ed.CallTipActive(), 0) + self.ed.CallTipShow(1, "fun(int x)") + self.assertEquals(self.ed.CallTipActive(), 1) + self.assertEquals(self.ed.CallTipPosStart(), 4) + self.ed.CallTipSetPosStart(1) + self.assertEquals(self.ed.CallTipPosStart(), 1) + self.ed.CallTipCancel() + self.assertEquals(self.ed.CallTipActive(), 0) + class TestAutoComplete(unittest.TestCase): def setUp(self): -- cgit v1.2.3