Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix startup errors and style issues #106

Merged
merged 2 commits into from
May 13, 2015
Merged

Fix startup errors and style issues #106

merged 2 commits into from
May 13, 2015

Conversation

izidormatusov
Copy link
Contributor

No description provided.

@izidormatusov izidormatusov force-pushed the fix-startup branch 2 times, most recently from 305e8f8 to c3c04a2 Compare May 7, 2015 06:52
@izidormatusov
Copy link
Contributor Author

I find that the first commit of this PR (4183e95) solves opening the editor better than #82

izidormatusov and others added 2 commits May 12, 2015 09:07
In the newer Gtk (tested on 3.14 that is included in Ubuntu 15.04), there was a slight change in semantics of forward_word_end. If there is a trailing white space, forward_word_end doesn't move to the end of buffer as it is not a word per se,  but returns an error (value False).

The following script runs in infinite loop under new Gtk:

```python

from gi.repository import Gtk

buf = Gtk.TextBuffer()
buf.set_text("word ")
it, end = buf.get_bounds()

while (it.get_offset() < end.get_offset()) and (it.get_char() != '\0'):
    it.forward_word_end()
    prev = it.copy()
    prev.backward_word_start()
    print('word: "{}"'.format(buf.get_text(prev, it, True)))
```

Fix is to check the return value of it.forward_word_end() in while loop:

```python
while it.forward_word_end():
    prev = it.copy()
    prev.backward_word_start()
    print('word: "{}"'.format(buf.get_text(prev, it, True)))
```

Fixes #90
@jakubbrindza
Copy link
Contributor

Thank you for putting your commit message in a clear way. Now I get why you made the change with forward_word_end(). Everything else seemed reasonable and right to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants