diff options
| -rw-r--r-- | doc/ScintillaDoc.html | 4 | ||||
| -rw-r--r-- | include/Scintilla.h | 1 | ||||
| -rw-r--r-- | include/Scintilla.iface | 3 | ||||
| -rw-r--r-- | src/Editor.cxx | 4 | ||||
| -rw-r--r-- | test/simpleTests.py | 23 | 
5 files changed, 34 insertions, 1 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 4b947dd11..f87d03578 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -1016,6 +1016,7 @@ struct TextToFind {       <a class="message" href="#SCI_GETLENGTH">SCI_GETLENGTH</a><br />       <a class="message" href="#SCI_GETLINECOUNT">SCI_GETLINECOUNT</a><br />       <a class="message" href="#SCI_GETFIRSTVISIBLELINE">SCI_GETFIRSTVISIBLELINE</a><br /> +     <a class="message" href="#SCI_SETFIRSTVISIBLELINE">SCI_SETFIRSTVISIBLELINE(int lineDisplay)</a><br />       <a class="message" href="#SCI_LINESONSCREEN">SCI_LINESONSCREEN</a><br />       <a class="message" href="#SCI_GETMODIFY">SCI_GETMODIFY</a><br />       <a class="message" href="#SCI_SETSEL">SCI_SETSEL(int anchorPos, int currentPos)</a><br /> @@ -1075,7 +1076,8 @@ struct TextToFind {      document holding only an end of line sequence has 2 lines.</p>      <p><b id="SCI_GETFIRSTVISIBLELINE">SCI_GETFIRSTVISIBLELINE</b><br /> -     This returns the line number of the first visible line in the Scintilla view. The first line +     <b id="SCI_SETFIRSTVISIBLELINE">SCI_SETFIRSTVISIBLELINE(int lineDisplay)</b><br /> +     These messages retrieve and set the line number of the first visible line in the Scintilla view. The first line      in the document is numbered 0. The value is a visible line rather than a document line.</p>      <p><b id="SCI_LINESONSCREEN">SCI_LINESONSCREEN</b><br /> diff --git a/include/Scintilla.h b/include/Scintilla.h index e38d74cba..a702fd90d 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -485,6 +485,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,  #define SC_EFF_QUALITY_LCD_OPTIMIZED 3  #define SCI_SETFONTQUALITY 2611  #define SCI_GETFONTQUALITY 2612 +#define SCI_SETFIRSTVISIBLELINE 2613  #define SCI_TARGETFROMSELECTION 2287  #define SCI_LINESJOIN 2288  #define SCI_LINESSPLIT 2289 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 64c73327b..05aa5ab9f 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -1220,6 +1220,9 @@ set void SetFontQuality=2611(int fontQuality,)  # Retrieve the quality level for text.  get int GetFontQuality=2612(,) +# Scroll so that a display line is at the top of the display. +set int SetFirstVisibleLine=2613(int lineDisplay,) +  # Make the target range start and end be the same as the selection range start and end.  fun void TargetFromSelection=2287(,) diff --git a/src/Editor.cxx b/src/Editor.cxx index f6e7b0603..f9eee5acc 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -6499,6 +6499,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  	case SCI_GETFIRSTVISIBLELINE:  		return topLine; +	case SCI_SETFIRSTVISIBLELINE: +		ScrollTo(wParam); +		break; +  	case SCI_GETLINE: {	// Risk of overwriting the end of the buffer  			int lineStart = pdoc->LineStart(wParam);  			int lineEnd = pdoc->LineStart(wParam + 1); diff --git a/test/simpleTests.py b/test/simpleTests.py index feab296b9..2793361b2 100644 --- a/test/simpleTests.py +++ b/test/simpleTests.py @@ -697,6 +697,29 @@ class TestIndicators(unittest.TestCase):  		self.assertEquals(self.ed.IndicGetStyle(0), 2)  		self.assertEquals(self.ed.IndicGetFore(0), 0xff0080) +class TestScrolling(unittest.TestCase): + +	def setUp(self): +		self.xite = XiteWin.xiteFrame +		self.ed = self.xite.ed +		self.ed.ClearAll() +		self.ed.EmptyUndoBuffer() +		# 150 should be enough lines +		self.ed.InsertText(0, b"a\n" * 150) + +	def testTop(self): +		self.ed.GotoLine(0) +		self.assertEquals(self.ed.FirstVisibleLine, 0) + +	def testLineScroll(self): +		self.ed.GotoLine(0) +		self.ed.LineScroll(0, 3) +		self.assertEquals(self.ed.FirstVisibleLine, 3) + +	def testVisibleLine(self): +		self.ed.FirstVisibleLine = 7 +		self.assertEquals(self.ed.FirstVisibleLine, 7) +  class TestSearch(unittest.TestCase):  	def setUp(self):  | 
