Zim

Copy-pasting within a verbatim code block introduces newlines

Bug #1300016 reported by Sparhawk
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zim
Fix Released
Undecided
Unassigned
zim (Ubuntu)
Fix Committed
Undecided
Unassigned

Bug Description

To replicate
=========

1) Create a multiline verbatim code block with
    '''
    code hre
    ''''
2) Reload page to format correctly.
3) Select the "e" in code, and copy to clipboard.
4) Move cursor between "h" and "r" and paste.

Expected results
==============
Source should look like this:
    '''
    code here
    ''''

Observed results
==============
Source looks like this:
    '''
    code h
    '''
    ''ere''

If you reload the page, you can see this results in a newline before the pasted "e", and the following code is also changed to "in-line" verbatim.

This is particularly problematic if you forget this bug exists, and forget to reload. If you attempt to copy edited code and paste into a terminal, you can potentially execute the wrong code, as the invisible newline is inserted in the clipboard.

For example… (DON'T DO THIS)
'''
sudo rm -rf /local/bin/usr/myscripts
'''

Oh, I got the path wrong! I'll just copy "usr/" and paste it before "local". Then, I'll copy the whole command and paste it into a terminal!

Obviously, here, `sudo rm -rf /` will be executed immediately, as the newline is parsed.

ProblemType: Bug
DistroRelease: Ubuntu 13.10
Package: zim 0.60-1
Uname: Linux 3.11.8-031108-generic x86_64
ApportVersion: 2.12.5-0ubuntu2.2
Architecture: amd64
Date: Mon Mar 31 16:25:53 2014
InstallationDate: Installed on 2012-12-16 (469 days ago)
InstallationMedia: Kubuntu 12.10 "Quantal Quetzal" - Release amd64 (20121017.1)
MarkForUpload: True
PackageArchitecture: all
SourcePackage: zim
UpgradeStatus: Upgraded to saucy on 2013-10-18 (164 days ago)

Revision history for this message
Sparhawk (sparhawkthesecond) wrote :
Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Tested in current dev branch and result is just a single line as in the Expected Result.

Flagging as fix committed, please re-open if still seen in dev branch or later in 0.61 and up

Changed in zim:
status: New → Fix Committed
Changed in zim (Ubuntu):
status: New → Fix Committed
Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Fixed in release 0.61

Changed in zim:
status: Fix Committed → Fix Released
Revision history for this message
Sparhawk (sparhawkthesecond) wrote :

Works great! Thanks for the fix.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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