Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6339715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:41:56+00:00 2026-05-24T19:41:56+00:00

I am trying to edit the same text (which I have stored in a

  • 0

I am trying to edit the same text (which I have stored in a GtkTextBuffer, but alternatives are welcome) with multiple cursors, each in a separate GtkTextView. I need all cursors to be able to edit the text (and be reflected in the other views). Moving one cursor (e.g., with the keyboard) should not move the other cursors.

For those familiar, I am trying to emulate the behaviour of emacs’ split window.

What is the simplest way to do this?

Background

The Text Widget Overview states that

Each buffer can be displayed by any number of views.

except the cursor is stored in the GtkTextBuffer rather than the GtkTextView. In particular, moving the cursor in one view would change the cursor location in all other views.

More technical details

I’m actually using pygtk and gtksourceview2 in my specific example. In particular, the GtkTextView is a GtkSourceView (gtksourceview2.View in python). But my question is not pygtk specific.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T19:41:57+00:00Added an answer on May 24, 2026 at 7:41 pm

    You can’t do that with GtkSourceView out of the box – you’ll have to write it yourself, unfortunately.

    The way I would go about writing that, is to subclass GtkSourceBuffer. Make it ‘wrap’ the original GtkSourceBuffer, but maintain its own separate cursor position. Then create two of these ‘wrapping’ source buffers and put them in the source views.

    Although, that wouldn’t work if you wanted to have all the cursors displayed in all the source views. Maybe you could subclass GtkSourceBuffer and just have it maintain a separate cursor position for each view it’s added to.

    What would you do if you selected a different bit of text in each view? I’d think about it carefully before you start coding.

    A quick’n’dirty way would be to connect to the ‘focus-in-event’ and ‘focus-out-event’ signals of the source views. On losing the focus, have the view record its current cursor position. Then on gaining the focus, have it restore that cursor position. That way, it would be almost like each view had its own cursor position.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a relatively big SSIS package which I'm trying to edit. I basically
I'm trying to do some image edit syncing between two of the same app
I'm trying to edit a textbox's text in a Page_Load form on an ASP.NET
I am trying to edit a record. I have the default route. When I
i have been trying to figure this out but i just can't.... for some
I'm trying to edit some assembly code which tends to be formatted in long
I'm trying to single source a form page which can be in edit mode
I'm trying to display two <div> elements on the same line, but in the
I have some simple example WinForms code which I am trying to translate into
I'm trying to edit the output joomla main_menu module so I can make a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.