join/split lines not working

Bug #880267 reported by Achim on 2011-10-23
34
This bug affects 7 people
Affects Status Importance Assigned to Milestone
gedit-plugins
New
Medium
gedit-plugins (Debian)
New
Undecided
Unassigned
gedit-plugins (Ubuntu)
Undecided
Unassigned

Bug Description

1) The release of Ubuntu you are using, via 'lsb_release -rd' or System -> About Ubuntu
Description: Ubuntu 11.10
Release: 11.10

2) The version of the package you are using, via 'apt-cache policy pkgname' or by checking in Software Center
gedit:
  Installiert: 3.2.1-0ubuntu1
  Kandidat: 3.2.1-0ubuntu1
  Versionstabelle:
 *** 3.2.1-0ubuntu1 0
        500 http://archive.ubuntu.com/ubuntu/ oneiric-proposed/main amd64 Packages
        100 /var/lib/dpkg/status
     3.2.0-0ubuntu1 0
        500 http://archive.ubuntu.com/ubuntu/ oneiric/main amd64 Packages

gedit-plugins:
  Installiert: 3.2.0-0ubuntu1
  Kandidat: 3.2.0-0ubuntu1
  Versionstabelle:
 *** 3.2.0-0ubuntu1 0
        500 http://archive.ubuntu.com/ubuntu/ oneiric/universe amd64 Packages
        100 /var/lib/dpkg/status

3) What you expected to happen
Lines should be joined or split if I use the plugin

4) What happened instead
Noting happens it doesn't work.
This is the error that I get, if I start gedit in an terminal.

Traceback (most recent call last):
  File "/usr/lib/gedit/plugins/joinlines.py", line 79, in <lambda>
    lambda a, w: split_lines(w))],
  File "/usr/lib/gedit/plugins/joinlines.py", line 171, in split_lines
    forward_to_word_end(current_word_end)
  File "/usr/lib/gedit/plugins/joinlines.py", line 218, in forward_to_word_end
    while ord(char) and (not (char in (' ', '\t', '\n', '\r'))):
TypeError: ord() expected a character, but string of length 2 found

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: gedit 3.2.1-0ubuntu1
ProcVersionSignature: Ubuntu 3.0.0-13.21-generic 3.0.6
Uname: Linux 3.0.0-13-generic x86_64
ApportVersion: 1.23-0ubuntu3
Architecture: amd64
CheckboxSubmission: 13741649d6b2dd56d757d58c3d964436
CheckboxSystem: da9af3b901b5569a389df6337f3d812f
Date: Sun Oct 23 11:35:19 2011
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Beta amd64 (20110906)
SourcePackage: gedit
UpgradeStatus: Upgraded to oneiric on 2011-09-30 (23 days ago)

Achim (ach1m) wrote :
tags: added: regression-proposed
affects: gedit (Ubuntu) → gedit-plugins (Ubuntu)
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gedit-plugins (Ubuntu):
status: New → Confirmed
Bryan76 (bryan76) wrote :

Same problem. Same packages, amd64.

bulgakov (bulgakov) wrote :

I solved this bug. I do not know if my workaround create other issues, but it works properly so far.

The problem is about the way 'ord()' deals with special characters in the final 'while' of
/usr/lib/gedit/plugins/joinlines.py

It seems to be a known issue in python.
You can try it out in python:
>>> char='è'
>>> ord(char)
fails, while
>>> char=u'è'
>>> ord(char)
works.

I did not managed to rewrite a working definition of 'char' in joinlines.py, but I believe that the call 'ord(char)' is only a test for 'while' to check is a character is found. Therefore, if a "string of length" >1 is given as 'char', in this case, it does not matter what character is, but only that 'char' contains a character.

As a newby of python, I solved this bug for the split/join-lines plugin replacing the two calls 'while ord(char)' with
'while ord(char[:1])' in the final lines of the file /usr/lib/gedit/plugins/joinlines.py,
it works!

Changed in gedit-plugins:
importance: Unknown → Medium
status: Unknown → New
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.