title: GtkTextView cursor alway on center line
body: <p>I have a <code>GtkTextView</code>, where I would like to be able to center the cursor vertically in the center.</p>
  
  <p>If the cursor is moved, the text should scroll up (or down), but the cursor should still stay in center position. </p>
  
  <p>I tried several things: Adding a margin on the first and last character of the textview, but that makes problems when adding text behind the first and last character. Also its not nice if one selects the first line, the selection color expands into the "empty" room.</p>
  
  <p>In short, I need to:</p>
  
  <ol>
  <li>Add a margin before the first line</li>
  <li>Add a margin after the last line</li>
  <li>Scroll text to center on <code>cursor_move</code> or <code>text_changed</code> (I currently solved this with</li>
  </ol>
  
  <pre class="lang-python prettyprint-override"><code>cursor_iter = self.TextBuffer.get_iter_at_mark(cursor)
  fflines = round(self.window_height/(2*20))
  cursor_iter.forward_visible_lines(fflines)
  self.TextEditor.scroll_to_iter(cursor_iter, 0.0, True, 0, 0.5)
  </code></pre>
  
  <p>However, with this approach I would need several newlines at the end of my textview. So if someone knows a better solution to that, I'd be happy to hear it)</p>
  
  <p>I was thinking about doing pixelbased scrolling, but I don't know how to go about this. </p>
  
  <p>I'd be happy to hear some suggestions!</p>